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

modal: implement first Modal app #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
app: simple cli web scraper
100stacks committed Jun 8, 2024

Verified

This commit was signed with the committer’s verified signature.
tersmitten Mischa ter Smitten
commit 4371defb8006c9513da9a1da058a591ca8676c40
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -3,6 +3,9 @@ __pycache__/
*.py[cod]
*$py.class

# OS files
*/*.DS_Store

# C extensions
*.so

18 changes: 18 additions & 0 deletions app/scrape.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import re
import sys
import urllib.request

def get_links(url):
response = urllib.request.urlopen(url)
html = response.read().decode("utf-8")
links = []

for match in re.finditer('href="(.*?)"', html):
links.append(match.group(1))

return links

if __name__ == "__main__":
links = get_links(sys.argv[1])

print(links)