mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-04 20:17:22 +01:00
[onetmvp] Add shortcut extractor
This commit is contained in:
parent
6092ccd058
commit
d31aa74fdb
@ -694,6 +694,7 @@
|
|||||||
from .onet import (
|
from .onet import (
|
||||||
OnetIE,
|
OnetIE,
|
||||||
OnetChannelIE,
|
OnetChannelIE,
|
||||||
|
OnetMVPIE,
|
||||||
)
|
)
|
||||||
from .onionstudios import OnionStudiosIE
|
from .onionstudios import OnionStudiosIE
|
||||||
from .ooyala import (
|
from .ooyala import (
|
||||||
|
@ -23,7 +23,7 @@ def _search_mvp_id(self, webpage):
|
|||||||
return self._search_regex(
|
return self._search_regex(
|
||||||
r'id=(["\'])mvp:(?P<id>.+?)\1', webpage, 'mvp id', group='id')
|
r'id=(["\'])mvp:(?P<id>.+?)\1', webpage, 'mvp id', group='id')
|
||||||
|
|
||||||
def _extract_from_id(self, video_id, webpage):
|
def _extract_from_id(self, video_id, webpage=None):
|
||||||
response = self._download_json(
|
response = self._download_json(
|
||||||
'http://qi.ckm.onetapi.pl/', video_id,
|
'http://qi.ckm.onetapi.pl/', video_id,
|
||||||
query={
|
query={
|
||||||
@ -74,8 +74,10 @@ def _extract_from_id(self, video_id, webpage):
|
|||||||
|
|
||||||
meta = video.get('meta', {})
|
meta = video.get('meta', {})
|
||||||
|
|
||||||
title = self._og_search_title(webpage, default=None) or meta['title']
|
title = (self._og_search_title(
|
||||||
description = self._og_search_description(webpage, default=None) or meta.get('description')
|
webpage, default=None) if webpage else None) or meta['title']
|
||||||
|
description = (self._og_search_description(
|
||||||
|
webpage, default=None) if webpage else None) or meta.get('description')
|
||||||
duration = meta.get('length') or meta.get('lenght')
|
duration = meta.get('length') or meta.get('lenght')
|
||||||
timestamp = parse_iso8601(meta.get('addDate'), ' ')
|
timestamp = parse_iso8601(meta.get('addDate'), ' ')
|
||||||
|
|
||||||
@ -89,6 +91,18 @@ def _extract_from_id(self, video_id, webpage):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class OnetMVPIE(OnetBaseIE):
|
||||||
|
_VALID_URL = r'onetmvp:(?P<id>\d+\.\d+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'onetmvp:381027.1509591944',
|
||||||
|
'only_matching': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
return self._extract_from_id(self._match_id(url))
|
||||||
|
|
||||||
|
|
||||||
class OnetIE(OnetBaseIE):
|
class OnetIE(OnetBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?onet\.tv/[a-z]/[a-z]+/(?P<display_id>[0-9a-z-]+)/(?P<id>[0-9a-z]+)'
|
_VALID_URL = r'https?://(?:www\.)?onet\.tv/[a-z]/[a-z]+/(?P<display_id>[0-9a-z-]+)/(?P<id>[0-9a-z]+)'
|
||||||
IE_NAME = 'onet.tv'
|
IE_NAME = 'onet.tv'
|
||||||
|
Loading…
Reference in New Issue
Block a user