switch around html feed and xml feed discovery

on second thought, I'd rather rearrange the code 
than insert new feeds into the beginning of the list
This commit is contained in:
Kyle Mahan 2015-02-04 14:18:46 -08:00
parent 7d1c05f383
commit 4a8f15ba26

View file

@ -204,7 +204,16 @@ def find_possible_feeds(origin):
})
elif content_type == 'text/html':
# if text/html, then parse and look for rel="alternate"
# if text/html, then parse and look for h-entries
hfeed = mf2util.interpret_feed(mf2py.parse(doc=resp.text), origin)
if hfeed.get('entries'):
feeds.append({
'origin': origin,
'feed': origin,
'type': 'html',
})
# then look for link rel="alternate"
soup = bs4.BeautifulSoup(resp.text)
for link in soup.find_all('link', {'rel': 'alternate'}):
if link.get('type') in xml_feed_types:
@ -215,12 +224,4 @@ def find_possible_feeds(origin):
'type': 'xml',
})
hfeed = mf2util.interpret_feed(mf2py.parse(doc=resp.text), origin)
if hfeed.get('entries'):
feeds.insert(0,{
'origin': origin,
'feed': origin,
'type': 'html',
})
return feeds