mirror of https://github.com/yt-dlp/yt-dlp.git
[odnoklassniki] Fix extraction and extend _VALID_URL (closes #6726)
This commit is contained in:
parent
39955b0451
commit
cdc8d0c373
|
@ -12,7 +12,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class OdnoklassnikiIE(InfoExtractor):
|
class OdnoklassnikiIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:odnoklassniki|ok)\.ru/(?:video|web-api/video/moviePlayer)/(?P<id>[\d-]+)'
|
_VALID_URL = r'https?://(?:www\.)?(?:odnoklassniki|ok)\.ru/(?:video|web-api/video/moviePlayer)/(?P<id>[\d-]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
# metadata in JSON
|
# metadata in JSON
|
||||||
'url': 'http://ok.ru/video/20079905452',
|
'url': 'http://ok.ru/video/20079905452',
|
||||||
|
@ -46,6 +46,9 @@ class OdnoklassnikiIE(InfoExtractor):
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://ok.ru/web-api/video/moviePlayer/20079905452',
|
'url': 'http://ok.ru/web-api/video/moviePlayer/20079905452',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.ok.ru/video/20648036891',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -56,7 +59,7 @@ class OdnoklassnikiIE(InfoExtractor):
|
||||||
|
|
||||||
player = self._parse_json(
|
player = self._parse_json(
|
||||||
unescapeHTML(self._search_regex(
|
unescapeHTML(self._search_regex(
|
||||||
r'data-attributes="([^"]+)"', webpage, 'player')),
|
r'data-options="([^"]+)"', webpage, 'player')),
|
||||||
video_id)
|
video_id)
|
||||||
|
|
||||||
flashvars = player['flashvars']
|
flashvars = player['flashvars']
|
||||||
|
|
Loading…
Reference in New Issue