Compare commits

..

3 Commits

Author SHA1 Message Date
Lesmiscore (Naoya Ozaki)
1275aeb955
[extractor/bigo] Fix extractor (#4312)
Closes #4139

Authored by: Lesmiscore
2022-07-09 15:00:34 +05:30
ischmidt20
170a031386
[extractor/fifa] Fix extractor (#4272)
Authored by: ischmidt20
2022-07-09 13:23:49 +05:30
Felix S
65493f64e1
[extractor/Audiodraft] Add extractors (#4288)
Based on https://github.com/yt-dlp/yt-dlp/pull/4259
Closes https://github.com/yt-dlp/yt-dlp/issues/4028

Authored by: fstirlitz, Ashish0804
2022-07-09 13:16:57 +05:30
4 changed files with 115 additions and 32 deletions

View File

@ -104,6 +104,10 @@ from .atttechchannel import ATTTechChannelIE
from .atvat import ATVAtIE from .atvat import ATVAtIE
from .audimedia import AudiMediaIE from .audimedia import AudiMediaIE
from .audioboom import AudioBoomIE from .audioboom import AudioBoomIE
from .audiodraft import (
AudiodraftCustomIE,
AudiodraftGenericIE,
)
from .audiomack import AudiomackIE, AudiomackAlbumIE from .audiomack import AudiomackIE, AudiomackAlbumIE
from .audius import ( from .audius import (
AudiusIE, AudiusIE,

View File

@ -0,0 +1,93 @@
from .common import InfoExtractor
from ..utils import int_or_none
class AudiodraftBaseIE(InfoExtractor):
def _audiodraft_extract_from_id(self, player_entry_id):
data_json = self._download_json(
'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', player_entry_id,
headers={
'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
}, data=f'id={player_entry_id}'.encode('utf-8'))
return {
'id': str(data_json['entry_id']),
'title': data_json.get('entry_title'),
'url': data_json['path'],
'vcodec': 'none',
'ext': 'mp3',
'uploader': data_json.get('designer_name'),
'uploader_id': data_json.get('designer_id'),
'webpage_url': data_json.get('entry_url'),
'like_count': int_or_none(data_json.get('entry_likes')),
'average_rating': int_or_none(data_json.get('entry_rating')),
}
class AudiodraftCustomIE(AudiodraftBaseIE):
IE_NAME = 'Audiodraft:custom'
_VALID_URL = r'https?://(?:[-\w]+)\.audiodraft\.com/entry/(?P<id>\d+)'
_TESTS = [{
'url': 'http://nokiatune.audiodraft.com/entry/5874',
'info_dict': {
'id': '9485',
'ext': 'mp3',
'title': 'Hula Hula Calls',
'uploader': 'unclemaki',
'uploader_id': '13512',
'average_rating': 5,
'like_count': int,
},
}, {
'url': 'http://vikinggrace.audiodraft.com/entry/501',
'info_dict': {
'id': '22241',
'ext': 'mp3',
'title': 'MVG Happy',
'uploader': 'frog',
'uploader_id': '19142',
'average_rating': 5,
'like_count': int,
},
}, {
'url': 'http://timferriss.audiodraft.com/entry/765',
'info_dict': {
'id': '19710',
'ext': 'mp3',
'title': 'ferris03',
'uploader': 'malex',
'uploader_id': '17335',
'average_rating': 5,
'like_count': int,
},
}]
def _real_extract(self, url):
id = self._match_id(url)
webpage = self._download_webpage(url, id)
player_entry_id = self._search_regex(r'playAudio\(\'(player_entry_\d+)\'\);', webpage, id, 'play entry id')
return self._audiodraft_extract_from_id(player_entry_id)
class AudiodraftGenericIE(AudiodraftBaseIE):
IE_NAME = 'Audiodraft:generic'
_VALID_URL = r'https?://www\.audiodraft\.com/contests/[^/#]+#entries&eid=(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.audiodraft.com/contests/570-Score-A-Video-Surprise-Us#entries&eid=30138',
'info_dict': {
'id': '30138',
'ext': 'mp3',
'title': 'DROP in sound_V2',
'uploader': 'TiagoSilva',
'uploader_id': '19452',
'average_rating': 4,
'like_count': int,
},
}]
def _real_extract(self, url):
id = self._match_id(url)
return self._audiodraft_extract_from_id(f'player_entry_{id}')

View File

@ -28,7 +28,7 @@ class BigoIE(InfoExtractor):
user_id = self._match_id(url) user_id = self._match_id(url)
info_raw = self._download_json( info_raw = self._download_json(
'https://bigo.tv/studio/getInternalStudioInfo', 'https://ta.bigo.tv/official_website/studio/getInternalStudioInfo',
user_id, data=urlencode_postdata({'siteId': user_id})) user_id, data=urlencode_postdata({'siteId': user_id}))
if not isinstance(info_raw, dict): if not isinstance(info_raw, dict):
@ -41,14 +41,14 @@ class BigoIE(InfoExtractor):
if not info.get('alive'): if not info.get('alive'):
raise ExtractorError('This user is offline.', expected=True) raise ExtractorError('This user is offline.', expected=True)
formats, subs = self._extract_m3u8_formats_and_subtitles(
info.get('hls_src'), user_id, 'mp4', 'm3u8')
return { return {
'id': info.get('roomId') or user_id, 'id': info.get('roomId') or user_id,
'title': info.get('roomTopic') or info.get('nick_name') or user_id, 'title': info.get('roomTopic') or info.get('nick_name') or user_id,
'formats': [{ 'formats': formats,
'url': info.get('hls_src'), 'subtitles': subs,
'ext': 'mp4',
'protocol': 'm3u8',
}],
'thumbnail': info.get('snapshot'), 'thumbnail': info.get('snapshot'),
'uploader': info.get('nick_name'), 'uploader': info.get('nick_name'),
'uploader_id': user_id, 'uploader_id': user_id,

View File

@ -16,21 +16,21 @@ class FifaIE(InfoExtractor):
'title': 'Italy v France | Final | 2006 FIFA World Cup Germany™ | Full Match Replay', 'title': 'Italy v France | Final | 2006 FIFA World Cup Germany™ | Full Match Replay',
'description': 'md5:f4520d0ee80529c8ba4134a7d692ff8b', 'description': 'md5:f4520d0ee80529c8ba4134a7d692ff8b',
'ext': 'mp4', 'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Replay'], 'categories': ['FIFA Tournaments'],
'thumbnail': 'https://digitalhub.fifa.com/transform/fa6f0b3e-a2e9-4cf7-9f32-53c57bcb7360/2006_Final_ITA_FRA', 'thumbnail': 'https://digitalhub.fifa.com/transform/fa6f0b3e-a2e9-4cf7-9f32-53c57bcb7360/2006_Final_ITA_FRA',
'duration': 8164, 'duration': 8165,
}, },
'params': {'skip_download': 'm3u8'}, 'params': {'skip_download': 'm3u8'},
}, { }, {
'url': 'https://www.fifa.com/fifaplus/pt/watch/1cg5r5Qt6Qt12ilkDgb1sV', 'url': 'https://www.fifa.com/fifaplus/pt/watch/1cg5r5Qt6Qt12ilkDgb1sV',
'info_dict': { 'info_dict': {
'id': '1cg5r5Qt6Qt12ilkDgb1sV', 'id': '1cg5r5Qt6Qt12ilkDgb1sV',
'title': 'Brasil x Alemanha | Semifinais | Copa do Mundo FIFA Brasil 2014 | Compacto', 'title': 'Brazil v Germany | Semi-finals | 2014 FIFA World Cup Brazil™ | Extended Highlights',
'description': 'md5:ba4ffcc084802b062beffc3b4c4b19d6', 'description': 'md5:d908c74ee66322b804ae2e521b02a855',
'ext': 'mp4', 'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Highlights'], 'categories': ['FIFA Tournaments', 'Highlights'],
'thumbnail': 'https://digitalhub.fifa.com/transform/d8fe6f61-276d-4a73-a7fe-6878a35fd082/FIFAPLS_100EXTHL_2014BRAvGER_TMB', 'thumbnail': 'https://digitalhub.fifa.com/transform/d8fe6f61-276d-4a73-a7fe-6878a35fd082/FIFAPLS_100EXTHL_2014BRAvGER_TMB',
'duration': 901, 'duration': 902,
'release_timestamp': 1404777600, 'release_timestamp': 1404777600,
'release_date': '20140708', 'release_date': '20140708',
}, },
@ -39,8 +39,8 @@ class FifaIE(InfoExtractor):
'url': 'https://www.fifa.com/fifaplus/fr/watch/3C6gQH9C2DLwzNx7BMRQdp', 'url': 'https://www.fifa.com/fifaplus/fr/watch/3C6gQH9C2DLwzNx7BMRQdp',
'info_dict': { 'info_dict': {
'id': '3C6gQH9C2DLwzNx7BMRQdp', 'id': '3C6gQH9C2DLwzNx7BMRQdp',
'title': 'Le but de Josimar contre le Irlande du Nord | Buts classiques', 'title': 'Josimar goal against Northern Ireland | Classic Goals',
'description': 'md5:16f9f789f09960bfe7220fe67af31f34', 'description': 'md5:cbe7e7bb52f603c9f1fe9a4780fe983b',
'ext': 'mp4', 'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Goal'], 'categories': ['FIFA Tournaments', 'Goal'],
'duration': 28, 'duration': 28,
@ -56,27 +56,13 @@ class FifaIE(InfoExtractor):
preconnect_link = self._search_regex( preconnect_link = self._search_regex(
r'<link[^>]+rel\s*=\s*"preconnect"[^>]+href\s*=\s*"([^"]+)"', webpage, 'Preconnect Link') r'<link[^>]+rel\s*=\s*"preconnect"[^>]+href\s*=\s*"([^"]+)"', webpage, 'Preconnect Link')
json_data = self._download_json(
f'{preconnect_link}/video/GetVideoPlayerData/{video_id}', video_id,
'Downloading Video Player Data', query={'includeIdents': True, 'locale': locale})
video_details = self._download_json( video_details = self._download_json(
f'{preconnect_link}/sections/videoDetails/{video_id}', video_id, 'Downloading Video Details', fatal=False) f'{preconnect_link}/sections/videoDetails/{video_id}', video_id, 'Downloading Video Details', fatal=False)
preplay_parameters = self._download_json( preplay_parameters = self._download_json(
f'{preconnect_link}/video/GetVerizonPreplayParameters', video_id, 'Downloading Preplay Parameters', query={ f'{preconnect_link}/video/GetVerizonPreplayParameters/{video_id}', video_id, 'Downloading Preplay Parameters')['preplayParameters']
'entryId': video_id,
'assetId': json_data['verizonAssetId'],
'useExternalId': False,
'requiresToken': json_data['requiresToken'],
'adConfig': 'fifaplusvideo',
'prerollAds': True,
'adVideoId': json_data['externalVerizonAssetId'],
'preIdentId': json_data['preIdentId'],
'postIdentId': json_data['postIdentId'],
})
cid = f'{json_data["preIdentId"]},{json_data["verizonAssetId"]},{json_data["postIdentId"]}' cid = preplay_parameters['contentId']
content_data = self._download_json( content_data = self._download_json(
f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={ f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={
'v': preplay_parameters['preplayAPIVersion'], 'v': preplay_parameters['preplayAPIVersion'],
@ -98,9 +84,9 @@ class FifaIE(InfoExtractor):
return { return {
'id': video_id, 'id': video_id,
'title': json_data.get('title'), 'title': video_details.get('title'),
'description': json_data.get('description'), 'description': video_details.get('description'),
'duration': int_or_none(json_data.get('duration')), 'duration': int_or_none(video_details.get('duration')),
'release_timestamp': unified_timestamp(video_details.get('dateOfRelease')), 'release_timestamp': unified_timestamp(video_details.get('dateOfRelease')),
'categories': traverse_obj(video_details, (('videoCategory', 'videoSubcategory'),)), 'categories': traverse_obj(video_details, (('videoCategory', 'videoSubcategory'),)),
'thumbnail': traverse_obj(video_details, ('backgroundImage', 'src')), 'thumbnail': traverse_obj(video_details, ('backgroundImage', 'src')),