mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 10:45:00 +00:00
Add scraper module for data extraction.
This commit is contained in:
parent
e2acc028d0
commit
65111591d7
1 changed files with 30 additions and 0 deletions
30
aider/scrape.py
Executable file
30
aider/scrape.py
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
from aider import __version__
|
||||
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
aider_url = 'https://github.com/paul-gauthier/aider'
|
||||
|
||||
def scrape_with_playwright(url):
|
||||
with sync_playwright() as p:
|
||||
try:
|
||||
browser = p.chromium.launch()
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
return
|
||||
|
||||
# user_agent = ??
|
||||
page = browser.new_page()
|
||||
page.goto(url)
|
||||
content = page.content()
|
||||
browser.close()
|
||||
|
||||
return content
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python playw.py <URL>")
|
||||
sys.exit(1)
|
||||
main(sys.argv[1])
|
Loading…
Add table
Add a link
Reference in a new issue