On Sunday, November 29, 2015 at 9:32:22 PM UTC-5, Cem Karan wrote: > You might want to look into Beautiful Soup > (https://pypi.python.org/pypi/beautifulsoup4), which is an HTML > screen-scraping tool. I've never used it, but I've heard good things about > it. > > Good luck, > Cem Karan > > On Nov 29, 2015, at 7:49 PM, ryguy7272 wrote: > > > I'm trying to figure out how to count words in a web site. Here is a > > sample of the link I want to scrape data from and count specific words. > > http://finance.yahoo.com/q/h?s=STRP+Headlines > > > > I only want to count certain words, like 'fraud', 'lawsuit', etc. I want > > to have a way to control for specific words. I have a couple Python > > scripts that do this for a text file, but not for a web site. I can post > > that, if that's helpful. > > > > -- > > https://mail.python.org/mailman/listinfo/python-list
Ok, this small script will grab everything from the link. import requests from bs4 import BeautifulSoup r = requests.get("http://finance.yahoo.com/q/h?s=STRP+Headlines") soup = BeautifulSoup(r.content) htmltext = soup.prettify() print htmltext Now, how can I count specific words like 'fraud' and 'lawsuit'? -- https://mail.python.org/mailman/listinfo/python-list