mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-30 22:24:28 +01:00
[tunein] Add support for embeds (closes #11579)
This commit is contained in:
parent
7a9e066972
commit
027e231295
2 changed files with 78 additions and 50 deletions
|
@ -73,6 +73,7 @@ from .kaltura import KalturaIE
|
||||||
from .eagleplatform import EaglePlatformIE
|
from .eagleplatform import EaglePlatformIE
|
||||||
from .facebook import FacebookIE
|
from .facebook import FacebookIE
|
||||||
from .soundcloud import SoundcloudIE
|
from .soundcloud import SoundcloudIE
|
||||||
|
from .tunein import TuneInBaseIE
|
||||||
from .vbox7 import Vbox7IE
|
from .vbox7 import Vbox7IE
|
||||||
from .dbtv import DBTVIE
|
from .dbtv import DBTVIE
|
||||||
from .piksel import PikselIE
|
from .piksel import PikselIE
|
||||||
|
@ -828,6 +829,21 @@ class GenericIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
'playlist_mincount': 7,
|
'playlist_mincount': 7,
|
||||||
},
|
},
|
||||||
|
# TuneIn station embed
|
||||||
|
{
|
||||||
|
'url': 'http://radiocnrv.com/promouvoir-radio-cnrv/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '204146',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'CNRV',
|
||||||
|
'location': 'Paris, France',
|
||||||
|
'is_live': True,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# Live stream
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
# Livestream embed
|
# Livestream embed
|
||||||
{
|
{
|
||||||
'url': 'http://www.esa.int/Our_Activities/Space_Science/Rosetta/Philae_comet_touch-down_webcast',
|
'url': 'http://www.esa.int/Our_Activities/Space_Science/Rosetta/Philae_comet_touch-down_webcast',
|
||||||
|
@ -2088,6 +2104,11 @@ class GenericIE(InfoExtractor):
|
||||||
if soundcloud_urls:
|
if soundcloud_urls:
|
||||||
return _playlist_from_matches(soundcloud_urls, getter=unescapeHTML, ie=SoundcloudIE.ie_key())
|
return _playlist_from_matches(soundcloud_urls, getter=unescapeHTML, ie=SoundcloudIE.ie_key())
|
||||||
|
|
||||||
|
# Look for tunein player
|
||||||
|
tunein_urls = TuneInBaseIE._extract_urls(webpage)
|
||||||
|
if tunein_urls:
|
||||||
|
return _playlist_from_matches(tunein_urls)
|
||||||
|
|
||||||
# Look for embedded mtvservices player
|
# Look for embedded mtvservices player
|
||||||
mtvservices_url = MTVServicesEmbeddedIE._extract_url(webpage)
|
mtvservices_url = MTVServicesEmbeddedIE._extract_url(webpage)
|
||||||
if mtvservices_url:
|
if mtvservices_url:
|
||||||
|
|
|
@ -11,6 +11,12 @@ from ..compat import compat_urlparse
|
||||||
class TuneInBaseIE(InfoExtractor):
|
class TuneInBaseIE(InfoExtractor):
|
||||||
_API_BASE_URL = 'http://tunein.com/tuner/tune/'
|
_API_BASE_URL = 'http://tunein.com/tuner/tune/'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _extract_urls(webpage):
|
||||||
|
return re.findall(
|
||||||
|
r'<iframe[^>]+src=["\'](?P<url>(?:https?://)?tunein\.com/embed/player/[pst]\d+)',
|
||||||
|
webpage)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
content_id = self._match_id(url)
|
content_id = self._match_id(url)
|
||||||
|
|
||||||
|
@ -69,8 +75,7 @@ class TuneInClipIE(TuneInBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?tunein\.com/station/.*?audioClipId\=(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?tunein\.com/station/.*?audioClipId\=(?P<id>\d+)'
|
||||||
_API_URL_QUERY = '?tuneType=AudioClip&audioclipId=%s'
|
_API_URL_QUERY = '?tuneType=AudioClip&audioclipId=%s'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
|
||||||
'url': 'http://tunein.com/station/?stationId=246119&audioClipId=816',
|
'url': 'http://tunein.com/station/?stationId=246119&audioClipId=816',
|
||||||
'md5': '99f00d772db70efc804385c6b47f4e77',
|
'md5': '99f00d772db70efc804385c6b47f4e77',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -78,21 +83,19 @@ class TuneInClipIE(TuneInBaseIE):
|
||||||
'title': '32m',
|
'title': '32m',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
},
|
},
|
||||||
},
|
}]
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class TuneInStationIE(TuneInBaseIE):
|
class TuneInStationIE(TuneInBaseIE):
|
||||||
IE_NAME = 'tunein:station'
|
IE_NAME = 'tunein:station'
|
||||||
_VALID_URL = r'https?://(?:www\.)?tunein\.com/(?:radio/.*?-s|station/.*?StationId\=)(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?tunein\.com/(?:radio/.*?-s|station/.*?StationId=|embed/player/s)(?P<id>\d+)'
|
||||||
_API_URL_QUERY = '?tuneType=Station&stationId=%s'
|
_API_URL_QUERY = '?tuneType=Station&stationId=%s'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def suitable(cls, url):
|
def suitable(cls, url):
|
||||||
return False if TuneInClipIE.suitable(url) else super(TuneInStationIE, cls).suitable(url)
|
return False if TuneInClipIE.suitable(url) else super(TuneInStationIE, cls).suitable(url)
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
|
||||||
'url': 'http://tunein.com/radio/Jazz24-885-s34682/',
|
'url': 'http://tunein.com/radio/Jazz24-885-s34682/',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '34682',
|
'id': '34682',
|
||||||
|
@ -103,17 +106,18 @@ class TuneInStationIE(TuneInBaseIE):
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True, # live stream
|
'skip_download': True, # live stream
|
||||||
},
|
},
|
||||||
},
|
}, {
|
||||||
]
|
'url': 'http://tunein.com/embed/player/s6404/',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
class TuneInProgramIE(TuneInBaseIE):
|
class TuneInProgramIE(TuneInBaseIE):
|
||||||
IE_NAME = 'tunein:program'
|
IE_NAME = 'tunein:program'
|
||||||
_VALID_URL = r'https?://(?:www\.)?tunein\.com/(?:radio/.*?-p|program/.*?ProgramId\=)(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?tunein\.com/(?:radio/.*?-p|program/.*?ProgramId=|embed/player/p)(?P<id>\d+)'
|
||||||
_API_URL_QUERY = '?tuneType=Program&programId=%s'
|
_API_URL_QUERY = '?tuneType=Program&programId=%s'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
|
||||||
'url': 'http://tunein.com/radio/Jazz-24-p2506/',
|
'url': 'http://tunein.com/radio/Jazz-24-p2506/',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '2506',
|
'id': '2506',
|
||||||
|
@ -124,17 +128,18 @@ class TuneInProgramIE(TuneInBaseIE):
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True, # live stream
|
'skip_download': True, # live stream
|
||||||
},
|
},
|
||||||
},
|
}, {
|
||||||
]
|
'url': 'http://tunein.com/embed/player/p191660/',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
class TuneInTopicIE(TuneInBaseIE):
|
class TuneInTopicIE(TuneInBaseIE):
|
||||||
IE_NAME = 'tunein:topic'
|
IE_NAME = 'tunein:topic'
|
||||||
_VALID_URL = r'https?://(?:www\.)?tunein\.com/topic/.*?TopicId\=(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?tunein\.com/(?:topic/.*?TopicId=|embed/player/t)(?P<id>\d+)'
|
||||||
_API_URL_QUERY = '?tuneType=Topic&topicId=%s'
|
_API_URL_QUERY = '?tuneType=Topic&topicId=%s'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
|
||||||
'url': 'http://tunein.com/topic/?TopicId=101830576',
|
'url': 'http://tunein.com/topic/?TopicId=101830576',
|
||||||
'md5': 'c31a39e6f988d188252eae7af0ef09c9',
|
'md5': 'c31a39e6f988d188252eae7af0ef09c9',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -143,8 +148,10 @@ class TuneInTopicIE(TuneInBaseIE):
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'location': 'Belgium',
|
'location': 'Belgium',
|
||||||
},
|
},
|
||||||
},
|
}, {
|
||||||
]
|
'url': 'http://tunein.com/embed/player/t101830576/',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
class TuneInShortenerIE(InfoExtractor):
|
class TuneInShortenerIE(InfoExtractor):
|
||||||
|
|
Loading…
Reference in a new issue