Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NODRIVER] configure nodriver browser to automatically download PDFs instead of opening them in browser #2067

Open
abhash-rai opened this issue Nov 6, 2024 · 0 comments

Comments

@abhash-rai
Copy link

Below script opens a download url to a pdf but it just opens the url (which is the default chrome behaviour-opening PDF in viewer) instead of downloading it. How do I modify below to set it to download instead? Thanks!

import asyncio
import nodriver as uc

async def crawl():    

    browser = await uc.start(headless=False)
    await browser.get("https://www.hkmj.org/system/files/hkmj166018.pdf")

    while True:
        await asyncio.sleep(0.2)  # Keep the event loop alive

if __name__ == '__main__':
    uc.loop().run_until_complete(crawl())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant