Created
September 27, 2016 15:27
-
-
Save dionnys5/8fe1f77cc4598ed939502d9a2c3ad3ac to your computer and use it in GitHub Desktop.
Salva em txt os ultimos tweets do UOL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import urllib.request | |
from bs4 import BeautifulSoup | |
url = "https://twitter.com/UOL" | |
WebPage = urllib.request.urlopen(url) | |
soup = BeautifulSoup(WebPage,"html.parser") | |
print("Tweet Scraping...") | |
with open("UolTweets.txt","w") as f: | |
for tweets in soup.findAll('div',{"class":"content"}): | |
t = tweets.find('p').text | |
f.write(t+"\n") | |
print("Done!") | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment