]>
Commit | Line | Data |
---|---|---|
61f317c2 | 1 | from .common import InfoExtractor |
304ad45a | 2 | from ..utils import clean_html, float_or_none, traverse_obj, unescapeHTML |
61f317c2 BC |
3 | |
4 | ||
5 | class AudioBoomIE(InfoExtractor): | |
3eaaa8ab YCH |
6 | _VALID_URL = r'https?://(?:www\.)?audioboom\.com/(?:boos|posts)/(?P<id>[0-9]+)' |
7 | _TESTS = [{ | |
86f63633 | 8 | 'url': 'https://audioboom.com/posts/7398103-asim-chaudhry', |
8dbad2a4 | 9 | 'md5': '4d68be11c9f9daf3dab0778ad1e010c3', |
61f317c2 | 10 | 'info_dict': { |
86f63633 | 11 | 'id': '7398103', |
61f317c2 | 12 | 'ext': 'mp3', |
86f63633 | 13 | 'title': 'Asim Chaudhry', |
8dbad2a4 | 14 | 'description': 'md5:0ed714ae0e81e5d9119cac2f618ad679', |
86f63633 RA |
15 | 'duration': 4000.99, |
16 | 'uploader': 'Sue Perkins: An hour or so with...', | |
17 | 'uploader_url': r're:https?://(?:www\.)?audioboom\.com/channel/perkins', | |
61f317c2 | 18 | } |
8dbad2a4 TI |
19 | }, { # Direct mp3-file link |
20 | 'url': 'https://audioboom.com/posts/8128496.mp3', | |
21 | 'md5': 'e329edf304d450def95c7f86a9165ee1', | |
22 | 'info_dict': { | |
23 | 'id': '8128496', | |
24 | 'ext': 'mp3', | |
25 | 'title': 'TCRNo8 / DAILY 03 - In Control', | |
26 | 'description': 'md5:44665f142db74858dfa21c5b34787948', | |
27 | 'duration': 1689.7, | |
28 | 'uploader': 'Lost Dot Podcast: The Trans Pyrenees and Transcontinental Race', | |
29 | 'uploader_url': r're:https?://(?:www\.)?audioboom\.com/channels/5003904', | |
30 | } | |
3eaaa8ab YCH |
31 | }, { |
32 | 'url': 'https://audioboom.com/posts/4279833-3-09-2016-czaban-hour-3?t=0', | |
33 | 'only_matching': True, | |
34 | }] | |
61f317c2 BC |
35 | |
36 | def _real_extract(self, url): | |
37 | video_id = self._match_id(url) | |
8dbad2a4 | 38 | webpage = self._download_webpage(f'https://audioboom.com/posts/{video_id}', video_id) |
883c0523 | 39 | |
8dbad2a4 TI |
40 | clip_store = self._search_json( |
41 | r'data-react-class="V5DetailPagePlayer"\s*data-react-props=["\']', | |
42 | webpage, 'clip store', video_id, fatal=False, transform_source=unescapeHTML) | |
43 | clip = traverse_obj(clip_store, ('clips', 0), expected_type=dict) or {} | |
61f317c2 BC |
44 | |
45 | return { | |
46 | 'id': video_id, | |
8dbad2a4 TI |
47 | 'url': clip.get('clipURLPriorToLoading') or self._og_search_property('audio', webpage, 'audio url'), |
48 | 'title': clip.get('title') or self._html_search_meta(['og:title', 'og:audio:title', 'audio_title'], webpage), | |
49 | 'description': (clip.get('description') or clean_html(clip.get('formattedDescription')) | |
50 | or self._og_search_description(webpage)), | |
51 | 'duration': float_or_none(clip.get('duration') or self._html_search_meta('weibo:audio:duration', webpage)), | |
52 | 'uploader': clip.get('author') or self._html_search_meta( | |
53 | ['og:audio:artist', 'twitter:audio:artist_name', 'audio_artist'], webpage, 'uploader'), | |
54 | 'uploader_url': clip.get('author_url') or self._html_search_regex( | |
55 | r'<div class="avatar flex-shrink-0">\s*<a href="(?P<uploader_url>http[^"]+)"', | |
56 | webpage, 'uploader url', fatal=False), | |
61f317c2 | 57 | } |