Skip to content

Instantly share code, notes, and snippets.

@alecxe
Created September 10, 2014 01:58
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 alecxe/a4e99a79f0afa60cc52b to your computer and use it in GitHub Desktop.
Save alecxe/a4e99a79f0afa60cc52b to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
urls = ["https://www304.americanexpress.com/credit-card/compare"]
for url in urls:
website = requests.get(url)
soup = BeautifulSoup(website.content)
print(''.join([element.text for element in soup.body.find_all(lambda tag: tag != 'script', recursive=False)]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment