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:
parent
7d1c05f383
commit
4a8f15ba26
1 changed files with 10 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue