Skip to content

Instantly share code, notes, and snippets.

View amirmohammadrazmy's full-sized avatar

Amirmohammad Razmy amirmohammadrazmy

  • iran
View GitHub Profile
@AO8
AO8 / crawler.py
Last active May 23, 2023 09:12
Crawl a website and gather all internal links with Python and BeautifulSoup.
# Adapted from example in Ch.3 of "Web Scraping With Python, Second Edition" by Ryan Mitchell
import re
import requests
from bs4 import BeautifulSoup
pages = set()
def get_links(page_url):
global pages