Last active
January 2, 2025 21:40
-
-
Save ZSendokame/d3894b86e6db776b826b2af76e2c89c6 to your computer and use it in GitHub Desktop.
Small script to do scraping from the terminal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fly | |
| import arguing | |
| args = arguing.Arguing() | |
| selector = args.set('--selector', required=True) | |
| work = args.set('--map') | |
| html = fly.HTML(args.pipe()) | |
| selected = html.css(selector) | |
| for match in selected: | |
| if work is not None: | |
| print(eval(work, {'tag': match})) | |
| else: | |
| print(match.text()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment