aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2018-10-05 22:45:04 +0100
committerRemita Amine <remitamine@gmail.com>2018-10-05 22:45:04 +0100
commit19a352854f5143b7cd120e990433d0fd40f617b0 (patch)
treee7976ade12c27c49744d84ccc006aaf42f4bd343 /youtube_dl/extractor
parentc9d891f19a923f53132b49a1f5b97f344d92503c (diff)
[patreon] extract post_file url(#17792)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/patreon.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/youtube_dl/extractor/patreon.py b/youtube_dl/extractor/patreon.py
index 6f73ed68d..426dd8121 100644
--- a/youtube_dl/extractor/patreon.py
+++ b/youtube_dl/extractor/patreon.py
@@ -104,16 +104,18 @@ class PatreonIE(InfoExtractor):
'comment_count': int_or_none(attributes.get('comment_count')),
}
+ def add_file(file_data):
+ file_url = file_data.get('url')
+ if file_url:
+ info.update({
+ 'url': file_url,
+ 'ext': determine_ext(file_data.get('name'), 'mp3'),
+ })
+
for i in post.get('included', []):
i_type = i.get('type')
if i_type == 'attachment':
- attachment_attributes = i.get('attributes') or {}
- attachment_url = attachment_attributes.get('url')
- if attachment_url:
- info.update({
- 'url': attachment_url,
- 'ext': determine_ext(attachment_attributes.get('name'), 'mp3'),
- })
+ add_file(i.get('attributes') or {})
elif i_type == 'user':
user_attributes = i.get('attributes')
if user_attributes:
@@ -123,6 +125,9 @@ class PatreonIE(InfoExtractor):
})
if not info.get('url'):
+ add_file(attributes.get('post_file') or {})
+
+ if not info.get('url'):
info.update({
'_type': 'url',
'url': attributes['embed']['url'],