Skip to content

Instantly share code, notes, and snippets.

@firesofmay
Created March 16, 2013 18:15
Show Gist options
  • Save firesofmay/5177618 to your computer and use it in GitHub Desktop.
Save firesofmay/5177618 to your computer and use it in GitHub Desktop.
from BeautifulSoup import BeautifulSoup
import requests
url = "http://www.the-numbers.com/movie/%s"
payload = "Die-Hard-5"
cast = list()
technicals = list()
r = requests.get(url % payload )
soup = BeautifulSoup(r.text)
table1 = soup.findAll("div", {"id" : "cast"})[0]
table2 = soup.findAll("div", {"id" : "cast"})[1]
table1_rows = table1.findAll("tr")
for t in table1_rows:
cast.append((t.findAll("td")[0].text, t.findAll("td")[2].text))
table2_rows = table2.findAll("tr")
for t in table2_rows:
technicals.append((t.findAll("td")[0].text, t.findAll("td")[2].text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment