Skip to content

Instantly share code, notes, and snippets.

@santhalakshminarayana
Created January 6, 2020 05:30
Show Gist options
  • Save santhalakshminarayana/e446c66eb94055d0d6a8bd5ea54d0912 to your computer and use it in GitHub Desktop.
Save santhalakshminarayana/e446c66eb94055d0d6a8bd5ea54d0912 to your computer and use it in GitHub Desktop.
Web scrapping 1 - Medium
import requests
from bs4 import BeautifulSoup
import re
import os
import time
home_url = 'http://www.wiseoldsayings.com'
r = requests.get(home_url)
soup = BeautifulSoup(r.content, 'html5lib')
quote_classes = []
quote_hrefs = []
cat_list = soup.find('div', attrs = {'class':'cat_list'})
for row in cat_list.findAll('li'):
quote_classes.append(row.text.strip())
quote_hrefs.append(row.a['href'].strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment