mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-18 10:49:30 +01:00
[ie/TV5MondePlus] Use more get_element_by_class.
This commit is contained in:
parent
1aa522dfc4
commit
24e9dab586
@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
clean_html,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
|
get_element_by_class,
|
||||||
get_element_html_by_class,
|
get_element_html_by_class,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
@ -148,16 +150,13 @@ def process_video_files(v):
|
|||||||
duration = (int_or_none(try_get(metadata, lambda x: x['content']['duration']))
|
duration = (int_or_none(try_get(metadata, lambda x: x['content']['duration']))
|
||||||
or parse_duration(self._html_search_meta('duration', webpage)))
|
or parse_duration(self._html_search_meta('duration', webpage)))
|
||||||
|
|
||||||
title = episode = self._html_search_regex(r'<h1 class="main-title">([^<]+)', webpage, 'title', default=None)
|
title = episode = clean_html(get_element_by_class('main-title', webpage))
|
||||||
subtitle = self._html_search_regex(r'<p class="video-subtitle">([^<]+)', webpage, 'subtitle', default=None)
|
subtitle = clean_html(get_element_by_class('video-subtitle', webpage))
|
||||||
if subtitle:
|
if subtitle:
|
||||||
episode = subtitle
|
episode = subtitle
|
||||||
|
|
||||||
ep_summary = get_element_html_by_class('ep-summary', webpage)
|
ep_summary = get_element_html_by_class('ep-summary', webpage)
|
||||||
|
description = clean_html(get_element_by_class('text', ep_summary))
|
||||||
description = self._html_search_regex(
|
|
||||||
r'<p class="text">(.+?)</p>', ep_summary,
|
|
||||||
'description', fatal=False, flags=re.DOTALL)
|
|
||||||
|
|
||||||
upload_date = self._search_regex(
|
upload_date = self._search_regex(
|
||||||
r'(?:date_publication|publish_date)["\']\s*:\s*["\'](\d{4}_\d{2}_\d{2})',
|
r'(?:date_publication|publish_date)["\']\s*:\s*["\'](\d{4}_\d{2}_\d{2})',
|
||||||
@ -182,6 +181,6 @@ def process_video_files(v):
|
|||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': self._extract_subtitles(self._parse_json(
|
'subtitles': self._extract_subtitles(self._parse_json(
|
||||||
traverse_obj(vpl_data, ('data-captions', {str}), default='{}'), display_id, fatal=False)),
|
traverse_obj(vpl_data, ('data-captions', {str}), default='{}'), display_id, fatal=False)),
|
||||||
'series': self._html_search_regex(r'<p class="video-title">([^<]+)', webpage, 'title', default=None),
|
'series': clean_html(get_element_by_class('video-title', webpage)),
|
||||||
'episode': episode,
|
'episode': episode,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user