-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add a high level Python API #145
Comments
Might be better to provide a class, so you can instantiate once (loading up the headless browser) and then use it for multiple things. Or... do that, but still have a |
Initial rough API design: shot_scraper.javascript(url, javascript_code) -> a JSON decoded result With keyword arguments for most of these:
image_bytes = shot_scraper.shot(url) With a TON of options, see https://shot-scraper.datasette.io/en/stable/screenshots.html#shot-scraper-shot-help ... etc |
This is going to end up being a pretty big refactor, because I'll want the CLI tool to use the new Python API under the hood. |
Prototyped this with Claude 3 Opus: https://gist.github.com/simonw/a43ee47f528c0d3dc894bb4ba38aa94a |
Another use-case where I'd love to be able to call shot-scraper directly from Python. |
In this NICAR workshop: https://github.com/dwillis/shot-scraper-nicar24
This code: https://github.com/dwillis/shot-scraper-nicar24/blob/main/demo.py
It shouldn't be necessary to have to use
subprocess
to do something this straight-forward inshot-scraper
. I'd like to support something like this instead:The text was updated successfully, but these errors were encountered: