aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastian de Groot <bastiandg@users.noreply.github.com>2018-04-29 17:14:37 +0200
committerSergey M <dstftw@gmail.com>2018-04-29 22:14:37 +0700
commit01aec8488084e62aa188b5167e57d01ef66cd256 (patch)
treeabdb49b3ab28908f7685c9064b30b7439625003e
parent12b0d4e0e1df6d6a8b9ce10b9a69013497adc2b0 (diff)
downloadyoutube-dl-01aec8488084e62aa188b5167e57d01ef66cd256.tar.xz
[generic] Prefer enclosures over links in RSS feeds
-rw-r--r--youtube_dl/extractor/generic.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index d48914495..252f97c26 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -191,6 +191,16 @@ class GenericIE(InfoExtractor):
'title': 'pdv_maddow_netcast_m4v-02-27-2015-201624',
}
},
+ # RSS feed with enclosures and unsupported link URLs
+ {
+ 'url': 'http://www.hellointernet.fm/podcast?format=rss',
+ 'info_dict': {
+ 'id': 'http://www.hellointernet.fm/podcast?format=rss',
+ 'description': 'CGP Grey and Brady Haran talk about YouTube, life, work, whatever.',
+ 'title': 'Hello Internet',
+ },
+ 'playlist_mincount': 100,
+ },
# SMIL from http://videolectures.net/promogram_igor_mekjavic_eng
{
'url': 'http://videolectures.net/promogram_igor_mekjavic_eng/video/1/smil.xml',
@@ -2026,13 +2036,15 @@ class GenericIE(InfoExtractor):
entries = []
for it in doc.findall('./channel/item'):
- next_url = xpath_text(it, 'link', fatal=False)
+ next_url = None
+ enclosure_nodes = it.findall('./enclosure')
+ for e in enclosure_nodes:
+ next_url = e.attrib.get('url')
+ if next_url:
+ break
+
if not next_url:
- enclosure_nodes = it.findall('./enclosure')
- for e in enclosure_nodes:
- next_url = e.attrib.get('url')
- if next_url:
- break
+ next_url = xpath_text(it, 'link', fatal=False)
if not next_url:
continue