Can someone show me the code, of lets say getting the Recent News from google every one 30 minutes and show them in my website using python?
I watched 44 videos tutorials and learned the basics stuff.
An example was:
import urllib2
from BeautifulSoup import BeautifulSoup
# or if your're using BeautifulSoup4:
# from bs4 import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen('http://www.timeanddate.com/worldclock/astronomy.html?n=78').read())
for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
tds = row('td')
print tds[0].string, tds[1].string
# will print date and sunrise
but a beginner like me cannot understand how this piece of code can help me solve the above example.
Here’s a trivial example that gets all the main titles from google news in every half an hour and prints them out. As for displaying them on your website depends on how it is implemented. For example if it gets it contents from a MYSQL database, you can easily make this script to update the DB every time it downloads the new titles.