aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/audioboom.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-03-11 19:44:17 +0600
committerSergey M․ <dstftw@gmail.com>2016-03-11 19:44:17 +0600
commit883c05237869ceea3eabdf1e4ca53f4b45d9a04b (patch)
tree5736373ba708987575118d18b0bcaab7408d6562 /youtube_dl/extractor/audioboom.py
parent61f317c24c040d051ec6652cb0d4c650c1fc0361 (diff)
[audioboom] Improve robustness and extract uploader (Closes #8812)
Diffstat (limited to 'youtube_dl/extractor/audioboom.py')
-rw-r--r--youtube_dl/extractor/audioboom.py41
1 files changed, 34 insertions, 7 deletions
diff --git a/youtube_dl/extractor/audioboom.py b/youtube_dl/extractor/audioboom.py
index 84d4755f5..2ec2d7092 100644
--- a/youtube_dl/extractor/audioboom.py
+++ b/youtube_dl/extractor/audioboom.py
@@ -15,25 +15,52 @@ class AudioBoomIE(InfoExtractor):
'ext': 'mp3',
'title': '3/09/2016 Czaban Hour 3',
'description': 'Guest: Nate Davis - NFL free agency, Guest: Stan Gans',
- 'duration': 2245.72
+ 'duration': 2245.72,
+ 'uploader': 'Steve Czaban',
+ 'uploader_url': 're:https?://(?:www\.)?audioboom\.com/channel/steveczabanyahoosportsradio',
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
+
webpage = self._download_webpage(url, video_id)
- title = self._og_search_title(webpage)
+ clip = None
+
+ clip_store = self._parse_json(
+ self._search_regex(
+ r'data-new-clip-store=(["\'])(?P<json>{.*?"clipId"\s*:\s*%s.*?})\1' % video_id,
+ webpage, 'clip store', default='{}', group='json'),
+ video_id, fatal=False)
+ if clip_store:
+ clips = clip_store.get('clips')
+ if clips and isinstance(clips, list) and isinstance(clips[0], dict):
+ clip = clips[0]
+
+ def from_clip(field):
+ if clip:
+ clip.get(field)
+
+ audio_url = from_clip('clipURLPriorToLoading') or self._og_search_property(
+ 'audio', webpage, 'audio url')
+ title = from_clip('title') or self._og_search_title(webpage)
+ description = from_clip('description') or self._og_search_description(webpage)
- download_url = self._og_search_property('audio', webpage, 'url')
+ duration = float_or_none(from_clip('duration') or self._html_search_meta(
+ 'weibo:audio:duration', webpage))
- duration = float_or_none(self._html_search_meta(
- 'weibo:audio:duration', webpage, fatal=False))
+ uploader = from_clip('author') or self._og_search_property(
+ 'audio:artist', webpage, 'uploader', fatal=False)
+ uploader_url = from_clip('author_url') or self._html_search_meta(
+ 'audioboo:channel', webpage, 'uploader url')
return {
'id': video_id,
+ 'url': audio_url,
'title': title,
- 'url': download_url,
- 'description': self._og_search_description(webpage),
+ 'description': description,
'duration': duration,
+ 'uploader': uploader,
+ 'uploader_url': uploader_url,
}