snapshot
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import argparse
|
||||
import contextlib
|
||||
import re
|
||||
|
||||
from playwright.sync_api import sync_playwright, Page
|
||||
|
||||
|
||||
def download_filejoker(url: str) -> dict:
|
||||
with launch_browser() as page:
|
||||
page.goto(url, referer='http://planetsuzy.org')
|
||||
page.get_by_role("button", name="Slow Download").click()
|
||||
page.get_by_role("button", name="Get Download Link").click()
|
||||
with page.expect_response(re.compile('https://fs.+.filejoker.net/')) as res:
|
||||
with page.expect_download(timeout=0) as dl:
|
||||
page.get_by_role("button", name="Download File").click(timeout=0)
|
||||
dl.value.cancel()
|
||||
print(dl.value.url)
|
||||
print(dl.value)
|
||||
page.pause()
|
||||
print()
|
||||
|
||||
|
||||
def download_filefox(url: str) -> dict:
|
||||
with launch_browser() as page:
|
||||
page.goto(url, referer='http://planetsuzy.org')
|
||||
page.get_by_role("button", name="Slow Download").click()
|
||||
page.get_by_role("button", name="Slow Download").click(timeout=0)
|
||||
with page.expect_response(re.compile('https://fs.+.filefox.net/')) as res:
|
||||
with page.expect_download(timeout=0) as dl:
|
||||
page.get_by_role("button", name="Download File").click(timeout=0)
|
||||
dl.value.cancel()
|
||||
print(dl.value.url)
|
||||
print(dl.value)
|
||||
page.pause()
|
||||
print()
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def launch_browser() -> Page:
|
||||
with sync_playwright() as playwright:
|
||||
with playwright.chromium.launch(headless=False) as browser:
|
||||
with browser.new_context() as context:
|
||||
with context.new_page() as page:
|
||||
yield page
|
||||
|
||||
|
||||
def parse_args():
|
||||
arger = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
arger.add_argument('url', help='URL to download', type=str)
|
||||
return arger.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
url = args.url
|
||||
download_filejoker(url)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# download_filejoker('https://filejoker.net/ofg59z1pqjjb')
|
||||
download_filefox('https://filefox.cc/qxd2yrxgu4ak')
|
||||
main()
|
||||
Reference in New Issue
Block a user