├── .gitignore ├── README.md ├── identifiers.py ├── main.py ├── pahe.py ├── requirements.txt ├── settings.py └── tes.py /.gitignore: -------------------------------------------------------------------------------- 1 | logs.log 2 | chromedriver.exe 3 | __pycache__/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pahe Bypasser 2 | 3 | A buggy method to automate link grabbing from pahe (It is what it is) 4 | 5 | ## How To Run 6 | 7 | ```bash 8 | 9 | pip install -r requirements.txt 10 | playwright install chromium 11 | playwright install-deps chromium 12 | python main.py 13 | 14 | change LINK_TYPE in identifiers.py accordingly 15 | ``` 16 | 17 | ### What's New 18 | 19 | Updated the pahe script 20 | 21 | Migrated the code base from selenium to playwright 22 | 23 | No need to setup webdrivers and browsers seperately 24 | 25 | ### NOTE 26 | 27 | Feel free to open issues! 28 | -------------------------------------------------------------------------------- /identifiers.py: -------------------------------------------------------------------------------- 1 | COOKIES_BUTTON='text="AGREE"' 2 | HUMAN_VERIFICATION='//*[@id="soralink-human-verif-main"]' 3 | GENERATE="#generater > img" 4 | SHOW_LINK="#showlink" 5 | CONTINUE='//*[@id="content"]/div/div/div[1]/div/div[1]/div[3]/center/p/a' 6 | LINK_TYPE=["shortc-button small purple"] 7 | # "shortc-button small green","shortc-button small red",] -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from playwright.async_api import async_playwright 3 | from identifiers import * 4 | from pahe import get_data, handle_second_tab 5 | from settings import Tools 6 | 7 | logger=Tools.logger 8 | 9 | async def run(playwright,url): 10 | browser = await playwright.chromium.launch() 11 | context = await browser.new_context() 12 | links = await get_data(context,url) 13 | for i in range(len(links)): 14 | new_page = await context.new_page() 15 | await new_page.goto(links[i]['href']) 16 | try: 17 | await new_page.locator(COOKIES_BUTTON).click() 18 | except: 19 | pass 20 | await new_page.locator(HUMAN_VERIFICATION).click() 21 | await new_page.click(GENERATE) 22 | final_link = await handle_second_tab(context,new_page) 23 | logger.info(final_link) 24 | # for getting cookies pop up 25 | await context.clear_cookies() 26 | await browser.close() 27 | 28 | async def main(): 29 | url = str(input("Enter the pahe url: ")) 30 | async with async_playwright() as playwright: 31 | await run(playwright,url) 32 | asyncio.run(main()) -------------------------------------------------------------------------------- /pahe.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | from settings import Tools 3 | from identifiers import * 4 | import base64 5 | import re 6 | 7 | link_regex = r"location\.href\s*=\s*atob\('(.*?)'\)" 8 | logger=Tools.logger 9 | 10 | async def handle_second_tab(context,page): 11 | async with context.expect_page() as second_page_info: 12 | await page.click(SHOW_LINK) 13 | new_page = await second_page_info.value 14 | await page.close() 15 | await new_page.wait_for_load_state() 16 | content=await new_page.content() 17 | await new_page.close() 18 | return await get_link(content) 19 | 20 | async def get_data(context,url): 21 | page = await context.new_page() 22 | await page.goto(url) 23 | soup = BeautifulSoup(await page.content(), 'html.parser') 24 | links = soup.find_all('a', class_=LINK_TYPE) 25 | logger.debug(links) 26 | await page.close() 27 | return links 28 | 29 | async def get_link(content): 30 | try: 31 | link = re.search(link_regex, content).group(1) 32 | link = base64.b64decode(link).decode('utf-8') 33 | except (AttributeError, TypeError): 34 | link = None 35 | return link -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | playwright -------------------------------------------------------------------------------- /settings.py: -------------------------------------------------------------------------------- 1 | import logging.config 2 | 3 | 4 | logging.basicConfig( 5 | level=logging.INFO, 6 | format="%(asctime)s [%(levelname)s] %(message)s", 7 | handlers=[ 8 | logging.FileHandler("logs.log"), 9 | logging.StreamHandler() 10 | ] 11 | ) 12 | 13 | class Tools(object): 14 | logger = logging.getLogger(__name__) 15 | -------------------------------------------------------------------------------- /tes.py: -------------------------------------------------------------------------------- 1 | import base64 2 | import re 3 | 4 | 5 | doc =''' 6 | Linegee | Approaching The Unknown 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 |
28 | 29 | 30 |
31 | 76 |
77 |
78 | 79 | 80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |

Claude Ptolemy

90 |
91 | 99 |
100 | 101 |
102 |
103 |

104 | Around 140 AD, Claude Ptolemy (90-168 AD) took the theory of Hipparchus. He exposes in his Almagest the first empirical theory of the movement of the Moon. Ptolemy confirms while correcting the geocentric system of Aristotle. He considers that the Earth is surrounded by 105 | a series of crystal spheres - up to 50 spheres - on which the planets and the Sun are fixed. The outer sphere contains the fixed stars behind which is always the divine fire. All these spheres move uniformly in accordance with Greek metaphysics.

However, this conception does not correctly explain the sometimes aberrant movement of certain planets such as Mars, which retrograde for a few months before resuming its normal course among the stars. On the other hand, since the tables of lunar positions did not conform to observations as time progressed, Ptolemy invented the theory of epicycles. Each planet describes a circular orbit, the epicycle, centered on the main orbit, called the deferent. To explain the smallest variations in the trajectories of the planets, Ptolemy further improves his system and 106 | imagines that the centers of the deferents are themselves offset from the center of the Earth, following a circular path called the eccentric.

But philosophically speaking, the idea of ​​Ptolemy tarnishes the brightness of the 107 | Sun. All the Middle Ages are conservative, the Man is the center of the concerns while the Church sees angels everywhere - some push even the planets - a way of counteracting the mechanism and the Greek geometry.

We are going through a period of lethargy during which new ideas were duly combated by religious dogmas and prejudices. Things remained frozen for nearly a thousand years because the clergy refused the irrationality of mathematicians. Nature could not be tamed. This attitude was contrary to the divine essence, for which everything was order and aesthetic, Bible in support. The clergy also referred to the ancient conceptions of Plato and Aristotle, whose very enlightened genius was authoritative for a few centuries.

108 |
109 |

110 | 111 |

112 |
113 | 114 | Continue 115 |
116 | 117 |
118 |

119 |
120 | 123 |
124 |
Share this Post: 125 |
126 | 128 | 130 | 132 |
133 |
134 |
135 |
136 |
137 |
⇐ Light 138 |
139 |
Stars ⇒ 140 |
141 |
142 |
143 |

Related Posts:

144 | 214 | 215 |
216 |
217 |
218 |

Leave a Comment

219 |
220 |
221 | 222 | 223 |
224 |
225 | 226 | 227 |
228 |
229 | 230 | 231 |
232 |
233 |
234 | 235 | 236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 | 417 |
418 |
419 |
420 | 430 |
431 |
432 | 433 | 434 | 435 | 440 | 446 | 447 |
449 | 451 | 452 |
453 |
454 | 455 | 461 | 482 |
483 | 484 | ''' 485 | 486 | link_regex = r"location\.href\s*=\s*atob\('(.*?)'\)" 487 | 488 | link = base64.b64decode(re.search(link_regex, doc).group(1)).decode('utf-8') 489 | print(link) --------------------------------------------------------------------------------