videotarget extractor
This commit is contained in:
parent
3240e9f582
commit
3e69892860
|
@ -1474,6 +1474,7 @@ from .videomore import (
|
|||
VideomoreSeasonIE,
|
||||
)
|
||||
from .videopress import VideoPressIE
|
||||
from .videotarget import VideoTargetIE
|
||||
from .vidio import VidioIE
|
||||
from .vidlii import VidLiiIE
|
||||
from .vidme import (
|
||||
|
|
|
@ -24,6 +24,7 @@ from .libsyn import LibsynIE
|
|||
from .xnews import XLinkIE
|
||||
from .tvp import TVPEmbedIE
|
||||
from .acast import ACastPlayerIE
|
||||
from .videotarget import VideoTargetIE
|
||||
|
||||
|
||||
class PulseVideoIE(InfoExtractor):
|
||||
|
@ -190,6 +191,13 @@ class PulsEmbedIE(InfoExtractor):
|
|||
'upload_date': '20210208',
|
||||
'timestamp': 1612764000,
|
||||
},
|
||||
}, {
|
||||
'url': 'pulsembed:P_Q2gen3E',
|
||||
'info_dict': {
|
||||
'id': '16028',
|
||||
'ext': 'mp4',
|
||||
'title': 'Słabe szanse na taki wzrost gospodarczy o jakim mówi rząd',
|
||||
},
|
||||
}]
|
||||
|
||||
@staticmethod
|
||||
|
@ -202,6 +210,10 @@ class PulsEmbedIE(InfoExtractor):
|
|||
return 'TVP'
|
||||
if '//html5-player.libsyn.com/' in ext_url:
|
||||
return 'Libsyn'
|
||||
if '//player.acast.com/' in ext_url:
|
||||
return 'ACastPlayer'
|
||||
if '//videotarget.pl/' in ext_url:
|
||||
return 'VideoTarget'
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
|
@ -271,6 +283,7 @@ class PulsEmbedIE(InfoExtractor):
|
|||
XLinkIE,
|
||||
TVPEmbedIE,
|
||||
ACastPlayerIE,
|
||||
VideoTargetIE,
|
||||
PulseVideoIE,
|
||||
):
|
||||
embie_urls = embie._extract_urls(webpage, url=referer)
|
||||
|
|
59
haruhi_dl/extractor/videotarget.py
Normal file
59
haruhi_dl/extractor/videotarget.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
# coding: utf-8
|
||||
|
||||
import base64
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
int_or_none,
|
||||
js_to_json,
|
||||
)
|
||||
|
||||
|
||||
class VideoTargetIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://videotarget\.pl/player/v1/content/(?P<id>[a-zA-Z\d_-]+={0,3})'
|
||||
|
||||
_TESTS = [{
|
||||
'url': 'https://videotarget.pl/player/v1/content/eyJzaXRlIjoxMDMzLCJwbGFjZW1lbnQiOjEwNzksInRlbXBsYXRlIjoyLCJjb250ZXh0IjoxNjA2NiwidHlwZSI6ImNvbnRlbnQifQ==?type=content',
|
||||
'info_dict': {
|
||||
'id': '16066',
|
||||
'ext': 'mp4',
|
||||
'title': 'Inflacja straszy rynki finansowe, niepokoją zwłaszcza rosnące ceny namu mieszkań',
|
||||
},
|
||||
}]
|
||||
|
||||
@staticmethod
|
||||
def _extract_urls(webpage, **kw):
|
||||
return [mobj.group('url')
|
||||
for mobj in re.finditer(
|
||||
r'<iframe\b[^>]+\bsrc=(["\'])(?P<url>%s(?:\?[^#]+)?(?:\#.+?)?)\1' % VideoTargetIE._VALID_URL,
|
||||
webpage)
|
||||
] + ['https://videotarget.pl/player/v1/content/' + mobj.group('vtid')
|
||||
for mobj in re.finditer(
|
||||
r'<div\b[^>]+?data-vt=(["\'])(?P<vtid>[a-zA-Z\d_-]+={0,3})\1',
|
||||
webpage)]
|
||||
|
||||
def _real_extract(self, url):
|
||||
b64_json_ident = self._match_id(url)
|
||||
ident = self._parse_json(
|
||||
base64.urlsafe_b64decode(b64_json_ident), b64_json_ident)
|
||||
video_id = str(ident['context'])
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
title = self._html_search_regex(r'<title>(.+?) - videotarget</title>', webpage, 'video title')
|
||||
|
||||
formats = []
|
||||
for qual in re.finditer(r'(?s)videoQualities\.push\(({.+?})\);', webpage):
|
||||
qual = self._parse_json(qual.group(1), video_id, js_to_json)
|
||||
formats.append({
|
||||
'height': int_or_none(qual['label'][:-1]),
|
||||
'url': qual['src'].replace('{ext}', 'mp4'),
|
||||
})
|
||||
self._sort_formats(formats)
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'title': title,
|
||||
'formats': formats,
|
||||
}
|
Loading…
Reference in a new issue