News download: Add support for Atom feeds that have no link field, instead an alternate link in the links field

This commit is contained in:
Kovid Goyal 2012-06-15 01:30:47 +05:30
parent ef7220caf3
commit 66c90b8cb0

View File

@ -463,7 +463,13 @@ class BasicNewsRecipe(Recipe):
url = article[key] url = article[key]
if url and url.startswith('http://'): if url and url.startswith('http://'):
return url return url
return article.get('link', None) ans = article.get('link', None)
if not ans and article.links:
for item in article.links:
if item.get('rel', 'alternate') == 'alternate':
ans = item['href']
break
return ans
def skip_ad_pages(self, soup): def skip_ad_pages(self, soup):
''' '''