mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-27 19:36:50 +01:00
parent
07ab44c420
commit
7279163412
@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
NO_DEFAULT,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,6 +21,18 @@ class TVN24IE(InfoExtractor):
|
|||||||
'description': 'Wyjątkowe orędzie Artura Andrusa, jednego z gości "Szkła kontaktowego".',
|
'description': 'Wyjątkowe orędzie Artura Andrusa, jednego z gości "Szkła kontaktowego".',
|
||||||
'thumbnail': 're:https?://.*[.]jpeg',
|
'thumbnail': 're:https?://.*[.]jpeg',
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
# different layout
|
||||||
|
'url': 'https://tvnmeteo.tvn24.pl/magazyny/maja-w-ogrodzie,13/odcinki-online,1,4,1,0/pnacza-ptaki-i-iglaki-odc-691-hgtv-odc-29,1771763.html',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1771763',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Pnącza, ptaki i iglaki (odc. 691 /HGTV odc. 29)',
|
||||||
|
'thumbnail': 're:https?://.*',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://fakty.tvn24.pl/ogladaj-online,60/53-konferencja-bezpieczenstwa-w-monachium,716431.html',
|
'url': 'http://fakty.tvn24.pl/ogladaj-online,60/53-konferencja-bezpieczenstwa-w-monachium,716431.html',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@ -35,18 +48,21 @@ class TVN24IE(InfoExtractor):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(
|
||||||
|
webpage, default=None) or self._search_regex(
|
||||||
|
r'<h\d+[^>]+class=["\']magazineItemHeader[^>]+>(.+?)</h',
|
||||||
|
webpage, 'title')
|
||||||
|
|
||||||
def extract_json(attr, name, fatal=True):
|
def extract_json(attr, name, default=NO_DEFAULT, fatal=True):
|
||||||
return self._parse_json(
|
return self._parse_json(
|
||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'\b%s=(["\'])(?P<json>(?!\1).+?)\1' % attr, webpage,
|
r'\b%s=(["\'])(?P<json>(?!\1).+?)\1' % attr, webpage,
|
||||||
name, group='json', fatal=fatal) or '{}',
|
name, group='json', default=default, fatal=fatal) or '{}',
|
||||||
video_id, transform_source=unescapeHTML, fatal=fatal)
|
display_id, transform_source=unescapeHTML, fatal=fatal)
|
||||||
|
|
||||||
quality_data = extract_json('data-quality', 'formats')
|
quality_data = extract_json('data-quality', 'formats')
|
||||||
|
|
||||||
@ -59,16 +75,24 @@ class TVN24IE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
description = self._og_search_description(webpage)
|
description = self._og_search_description(webpage, default=None)
|
||||||
thumbnail = self._og_search_thumbnail(
|
thumbnail = self._og_search_thumbnail(
|
||||||
webpage, default=None) or self._html_search_regex(
|
webpage, default=None) or self._html_search_regex(
|
||||||
r'\bdata-poster=(["\'])(?P<url>(?!\1).+?)\1', webpage,
|
r'\bdata-poster=(["\'])(?P<url>(?!\1).+?)\1', webpage,
|
||||||
'thumbnail', group='url')
|
'thumbnail', group='url')
|
||||||
|
|
||||||
|
video_id = None
|
||||||
|
|
||||||
share_params = extract_json(
|
share_params = extract_json(
|
||||||
'data-share-params', 'share params', fatal=False)
|
'data-share-params', 'share params', default=None)
|
||||||
if isinstance(share_params, dict):
|
if isinstance(share_params, dict):
|
||||||
video_id = share_params.get('id') or video_id
|
video_id = share_params.get('id')
|
||||||
|
|
||||||
|
if not video_id:
|
||||||
|
video_id = self._search_regex(
|
||||||
|
r'data-vid-id=["\'](\d+)', webpage, 'video id',
|
||||||
|
default=None) or self._search_regex(
|
||||||
|
r',(\d+)\.html', url, 'video id', default=display_id)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user