Compare commits

..

No commits in common. "acafd165ef92469db1ffff93828087610a9aec23" and "d7c1751bb67151ed26611f2bd7cac52ad092a9d7" have entirely different histories.

View File

@ -1,9 +1,9 @@
import base64 import base64
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
extract_attributes, extract_attributes,
get_elements_html_by_class,
int_or_none, int_or_none,
parse_iso8601, parse_iso8601,
) )
@ -18,18 +18,16 @@ class ViouslyIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': 'F_xQzS2jwb3', 'id': 'F_xQzS2jwb3',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Turbo du 07/09/2014\xa0: Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...', 'title': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...',
'description': 'Turbo du 07/09/2014\xa0: Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...', 'description': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...',
'age_limit': 0, 'age_limit': 0,
'upload_date': '20230328', 'upload_date': str,
'timestamp': 1680037507, 'timestamp': float,
'duration': 3716,
'categories': ['motors'],
} }
}] }]
def _extract_from_webpage(self, url, webpage): def _extract_from_webpage(self, url, webpage):
viously_players = re.findall(r'<div[^>]*class="(?:[^"]*\s)?v(?:iou)?sly-player(?:\s[^"]*)?"[^>]*>', webpage) viously_players = get_elements_html_by_class('viously-player', webpage) + get_elements_html_by_class('vsly-player', webpage)
if not viously_players: if not viously_players:
return return
@ -42,19 +40,19 @@ class ViouslyIE(InfoExtractor):
for video_id in traverse_obj(viously_players, (..., {extract_attributes}, 'id')): for video_id in traverse_obj(viously_players, (..., {extract_attributes}, 'id')):
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(
f'https://www.viously.com/video/hls/{video_id}/index.m3u8', video_id, fatal=False) f'https://www.viously.com/video/hls/{video_id}/index.m3u8', video_id, fatal=False)
if not formats:
continue
data = self._download_json( data = self._download_json(
f'https://www.viously.com/export/json/{video_id}', video_id, f'https://www.viously.com/export/json/{video_id}', video_id,
transform_source=custom_decode, fatal=False) transform_source=custom_decode, fatal=False)
if not formats or not data:
continue
yield { yield {
'id': video_id, 'id': video_id,
'formats': formats, 'formats': formats,
**traverse_obj(data, ('video', { **traverse_obj(data, ('video', {
'title': ('title', {str}), 'title': 'title',
'description': ('description', {str}), 'description': 'description',
'duration': ('duration', {int_or_none}), 'duration': ('duration', {int_or_none}),
'timestamp': ('iso_date', {parse_iso8601}), 'timestamp': ('iso_date', {parse_iso8601}),
'categories': ('category', 'name', {str}, {lambda x: [x] if x else None}), 'categories': ('category', {lambda x: [x['name']]}),
})), })),
} }