aboutsummaryrefslogtreecommitdiff
path: root/src/web/lib
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2016-01-31 18:02:52 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-31 18:02:52 +0100
commit5949bd6787f2a7fa910dea6036df0315e119b457 (patch)
tree5271b6f0a30a91f5cb43356c5a0624159c0f12d6 /src/web/lib
parentfixing breadcrum height (diff)
downloadnewspipe-5949bd6787f2a7fa910dea6036df0315e119b457.tar.gz
newspipe-5949bd6787f2a7fa910dea6036df0315e119b457.tar.bz2
newspipe-5949bd6787f2a7fa910dea6036df0315e119b457.zip
modal from nav
Diffstat (limited to 'src/web/lib')
-rw-r--r--src/web/lib/feed_utils.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/web/lib/feed_utils.py b/src/web/lib/feed_utils.py
index 14e6b82b..80800bec 100644
--- a/src/web/lib/feed_utils.py
+++ b/src/web/lib/feed_utils.py
@@ -9,6 +9,8 @@ from web.lib.utils import try_keys, try_get_icon_url, rebuild_url
logger = logging.getLogger(__name__)
logging.captureWarnings(True)
+ACCEPTED_MIMETYPES = ('application/rss+xml', 'application/rdf+xml',
+ 'application/atom+xml', 'application/xml', 'text/xml')
def is_parsing_ok(parsed_feed):
@@ -96,8 +98,11 @@ def construct_feed_from(url=None, fp_parsed=None, feed=None, query_site=True):
del feed['icon_url']
if not feed.get('link'):
- alternates = bs_parsed.find_all(check_keys(rel=['alternate'],
- type=['application/rss+xml']))
- if len(alternates) >= 1:
- feed['link'] = rebuild_url(alternates[0].attrs['href'], feed_split)
+ for type_ in ACCEPTED_MIMETYPES:
+ alternates = bs_parsed.find_all(check_keys(
+ rel=['alternate'], type=[type_]))
+ if len(alternates) >= 1:
+ feed['link'] = rebuild_url(alternates[0].attrs['href'],
+ feed_split)
+ break
return feed
bgstack15