mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[nicknight] Improve extraction (closes #10769)
This commit is contained in:
parent
9c82bba05d
commit
f449c061d0
2 changed files with 14 additions and 16 deletions
|
@ -596,7 +596,7 @@
|
||||||
from .nick import (
|
from .nick import (
|
||||||
NickIE,
|
NickIE,
|
||||||
NickDeIE,
|
NickDeIE,
|
||||||
NickNightAtIE,
|
NickNightIE,
|
||||||
)
|
)
|
||||||
from .niconico import NiconicoIE, NiconicoPlaylistIE
|
from .niconico import NiconicoIE, NiconicoPlaylistIE
|
||||||
from .ninecninemedia import (
|
from .ninecninemedia import (
|
||||||
|
|
|
@ -86,6 +86,11 @@ class NickDeIE(MTVServicesInfoExtractor):
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _extract_mrss_url(self, webpage, host):
|
||||||
|
return update_url_query(self._search_regex(
|
||||||
|
r'data-mrss=(["\'])(?P<url>http.+?)\1', webpage, 'mrss url', group='url'),
|
||||||
|
{'siteKey': host})
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
@ -93,16 +98,14 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
mrss_url = update_url_query(self._search_regex(
|
mrss_url = self._extract_mrss_url(webpage, host)
|
||||||
r'data-mrss=(["\'])(?P<url>http.+?)\1', webpage, 'mrss url', group='url'),
|
|
||||||
{'siteKey': host})
|
|
||||||
|
|
||||||
return self._get_videos_info_from_url(mrss_url, video_id)
|
return self._get_videos_info_from_url(mrss_url, video_id)
|
||||||
|
|
||||||
|
|
||||||
class NickNightAtIE(MTVServicesInfoExtractor):
|
class NickNightIE(NickDeIE):
|
||||||
IE_NAME = 'nicknight.de'
|
IE_NAME = 'nicknight'
|
||||||
_VALID_URL = r'https?://(?:www\.)nicknight\.(?:de|at|tv)/(?:playlist|shows)/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
_VALID_URL = r'https?://(?:www\.)(?P<host>nicknight\.(?:de|at|tv))/(?:playlist|shows)/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.nicknight.at/shows/977-awkward/videos/85987-nimmer-beste-freunde',
|
'url': 'http://www.nicknight.at/shows/977-awkward/videos/85987-nimmer-beste-freunde',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
@ -114,12 +117,7 @@ class NickNightAtIE(MTVServicesInfoExtractor):
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _extract_mrss_url(self, webpage, *args):
|
||||||
video_id = self._match_id(url)
|
return self._search_regex(
|
||||||
|
r'mrss\s*:\s*(["\'])(?P<url>http.+?)\1', webpage,
|
||||||
webpage = self._download_webpage(url, video_id)
|
'mrss url', group='url')
|
||||||
|
|
||||||
mrss_url = self._search_regex(
|
|
||||||
r'mrss: (["\'])(?P<url>http.+?)\1', webpage, 'mrss url', group='url')
|
|
||||||
|
|
||||||
return self._get_videos_info_from_url(mrss_url, video_id)
|
|
||||||
|
|
Loading…
Reference in a new issue