mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.5 KiB
Python
71 lines
2.5 KiB
Python
9 years ago
|
from .common import InfoExtractor
|
||
5 years ago
|
from ..utils import (
|
||
|
clean_html,
|
||
|
float_or_none,
|
||
|
)
|
||
9 years ago
|
|
||
|
|
||
|
class AudioBoomIE(InfoExtractor):
|
||
8 years ago
|
_VALID_URL = r'https?://(?:www\.)?audioboom\.com/(?:boos|posts)/(?P<id>[0-9]+)'
|
||
|
_TESTS = [{
|
||
5 years ago
|
'url': 'https://audioboom.com/posts/7398103-asim-chaudhry',
|
||
|
'md5': '7b00192e593ff227e6a315486979a42d',
|
||
9 years ago
|
'info_dict': {
|
||
5 years ago
|
'id': '7398103',
|
||
9 years ago
|
'ext': 'mp3',
|
||
5 years ago
|
'title': 'Asim Chaudhry',
|
||
|
'description': 'md5:2f3fef17dacc2595b5362e1d7d3602fc',
|
||
|
'duration': 4000.99,
|
||
|
'uploader': 'Sue Perkins: An hour or so with...',
|
||
|
'uploader_url': r're:https?://(?:www\.)?audioboom\.com/channel/perkins',
|
||
9 years ago
|
}
|
||
8 years ago
|
}, {
|
||
|
'url': 'https://audioboom.com/posts/4279833-3-09-2016-czaban-hour-3?t=0',
|
||
|
'only_matching': True,
|
||
|
}]
|
||
9 years ago
|
|
||
|
def _real_extract(self, url):
|
||
|
video_id = self._match_id(url)
|
||
9 years ago
|
|
||
9 years ago
|
webpage = self._download_webpage(url, video_id)
|
||
|
|
||
9 years ago
|
clip = None
|
||
|
|
||
|
clip_store = self._parse_json(
|
||
5 years ago
|
self._html_search_regex(
|
||
|
r'data-new-clip-store=(["\'])(?P<json>{.+?})\1',
|
||
9 years ago
|
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:
|
||
8 years ago
|
return clip.get(field)
|
||
9 years ago
|
|
||
|
audio_url = from_clip('clipURLPriorToLoading') or self._og_search_property(
|
||
|
'audio', webpage, 'audio url')
|
||
5 years ago
|
title = from_clip('title') or self._html_search_meta(
|
||
|
['og:title', 'og:audio:title', 'audio_title'], webpage)
|
||
|
description = from_clip('description') or clean_html(from_clip('formattedDescription')) or self._og_search_description(webpage)
|
||
9 years ago
|
|
||
9 years ago
|
duration = float_or_none(from_clip('duration') or self._html_search_meta(
|
||
|
'weibo:audio:duration', webpage))
|
||
9 years ago
|
|
||
5 years ago
|
uploader = from_clip('author') or self._html_search_meta(
|
||
|
['og:audio:artist', 'twitter:audio:artist_name', 'audio_artist'], webpage, 'uploader')
|
||
9 years ago
|
uploader_url = from_clip('author_url') or self._html_search_meta(
|
||
|
'audioboo:channel', webpage, 'uploader url')
|
||
9 years ago
|
|
||
|
return {
|
||
|
'id': video_id,
|
||
9 years ago
|
'url': audio_url,
|
||
9 years ago
|
'title': title,
|
||
9 years ago
|
'description': description,
|
||
9 years ago
|
'duration': duration,
|
||
9 years ago
|
'uploader': uploader,
|
||
|
'uploader_url': uploader_url,
|
||
9 years ago
|
}
|