Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created January 8, 2024 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyboggs/a6c376a2f6f6fcb5f37671b630d747bf to your computer and use it in GitHub Desktop.
Save jeremyboggs/a6c376a2f6f6fcb5f37671b630d747bf to your computer and use it in GitHub Desktop.
First few lines to get some web text for Beautiful Soup.
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0'}
page_url = 'https://example.com'
page_text = requests.get(page_url,headers=headers).text
soup = BeautifulSoup(feed_text);
print(soup);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment