I work with BeautifulSoup and either came up with an error or an error on my part. In my example, I am browsing the NY Times subsections site ...
import urllib2 from bs4 import BeautifulSoup website = "http://www.nytimes.com/pages/politics/index.html" data = BeautifulSoup(urllib2.urlopen(website).read()) print data
When I run the code, I come back with the title tag and what's inside it. However, it does not capture what is inside the body tags. If I changed the website URL to http://www.nytimes.com , BS will return the full page source. What's going on here, and why I do not get a body tag scanning http://www.nytimes.com/pages/politics/index.html ?
source share