Quote:
Originally Posted by soothsayer
here is waht I have now.
|
When pasting a recipe here, you should use the CODE tags (hash mark) or you lose all indents. Indents are critical for Python code.
Quote:
as you can see, "cover_url" is blank, i'm not sure how to format the variables because the url for it will change depending on the date, and it's my first time using python.
here is the basic format for the ny daily news cover page.
http://assets.nydailynews.com/img/20...tpage_0814.jpg
can somebody show me an example template on how to do this?
|
Here is one method: ("index" is just the URL to a page that has the cover in an img tag in a span tag of class "cover" where the src of the img tag is the URL to the cover)
Code:
def get_cover_url(self):
cover_url = None
soup = self.index_to_soup(self.index)
cover_item = soup.find('span', attrs={'class':'cover'})
if cover_item:
cover_url = cover_item.img['src']
return cover_url
thanks.
Quote:
i've another question, in the feeds section, what's that "u" for that just in front of the title and url? i.e., (u'NY Crime', u'http://www.nydailynews.com/news/ny_crime/index_rss.xml'),
|
It means the string is "unicode."