Last active
December 19, 2015 10:28
-
-
Save mushfiq/5940183 to your computer and use it in GitHub Desktop.
Vote update
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
BeautifulSoup==3.2.0 | |
requests==0.9.1 |
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 time | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
TIME_DELAY = 3 | |
NEWS_URL = 'http://banglanews24.com/detailsnews.php?nssl=a660f4b238d34c8709c63915a9aaedfc&nttl=06072013208775' | |
news_results = [] | |
def action(count): | |
resp = requests.get(NEWS_URL) | |
soup = BeautifulSoup(resp.content) | |
result = soup.find('h1') | |
if (count!=1) and (result.text not in news_results): | |
news_results.append(result.text) | |
return result.text | |
elif(count==1): | |
news_results.append(result.text) | |
return result.text | |
return | |
if __name__=='__main__': | |
i = 1 | |
while(i): | |
news = action(i) | |
if news!=None: | |
print news | |
i+=1 | |
time.sleep(TIME_DELAY) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment