Compare commits

...

3 Commits

Author SHA1 Message Date
Maxence
9a17e3a919 fix tests 2024-01-07 16:23:43 -05:00
Maxence
b657473c27 Remove Turbo extractor 2024-01-07 16:06:59 -05:00
Maxence
8a98f168e4 Add viously embedded extractor 2024-01-07 16:06:46 -05:00
4 changed files with 40 additions and 54 deletions

View File

@ -1471,7 +1471,6 @@
- **TuneInPodcast**
- **TuneInPodcastEpisode**
- **TuneInStation**
- **Turbo**
- **tv.dfb.de**
- **TV2**
- **TV2Article**
@ -1601,6 +1600,7 @@
- **ViMP:Playlist**
- **Vine**
- **vine:user**
- **viously**
- **Viqeo**
- **Viu**
- **viu:ott**: [*viu*](## "netrc machine")

View File

@ -2019,7 +2019,6 @@ from .tunein import (
TuneInPodcastEpisodeIE,
TuneInShortenerIE,
)
from .turbo import TurboIE
from .tv2 import (
TV2IE,
TV2ArticleIE,
@ -2223,6 +2222,7 @@ from .viki import (
VikiIE,
VikiChannelIE,
)
from .viously import ViouslyIE
from .viqeo import ViqeoIE
from .viu import (
ViuIE,

View File

@ -1,52 +0,0 @@
from .common import InfoExtractor
from ..utils import (
get_element_html_by_class,
)
class TurboIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?turbo\.fr/((?P<playlist>[_\d\w]+).xml)?'
_API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8'
_TEST = {
'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continental-gt-speed-ces-guide-achat-dacia.html',
'md5': '37a6c3381599381ff53a7e1e0575c0bc',
'info_dict': {
'id': 'F_xQzS2jwb3',
'ext': 'mp4',
'title': 'Turbo du 07/09/2014 : 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...',
}
}
def _entries(self, playlist):
items = playlist.findall('./channel/item')
for item in items:
if item is None or item.find('./link').text is None:
continue
yield self._extract_video(item.find('./link').text)
def _extract_video(self, url):
webpage = self._download_webpage(url, None)
viously_player = get_element_html_by_class('viously-player-wrapper', webpage)
video_id = self._html_search_regex(r'id="([-_\w]+)"', viously_player, 'video_id')
title = self._html_extract_title(webpage)
return {
'id': video_id,
'title': title,
'description': title,
'formats': self._extract_m3u8_formats(self._API_URL.format(video_id), video_id),
}
def _real_extract(self, url):
mobj = self._match_valid_url(url)
playlist_id = mobj.group('playlist')
if playlist_id and self._yes_playlist(playlist_id, None):
playlist = self._download_xml(url, playlist_id)
return self.playlist_result(
self._entries(playlist),
playlist_id,
playlist_title=playlist.find('./channel/title').text,
)
return self._extract_video(url)

View File

@ -0,0 +1,38 @@
from .common import InfoExtractor
from ..utils import (
get_element_html_by_class,
get_elements_html_by_class,
)
class ViouslyIE(InfoExtractor):
_VALID_URL = False
_API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8'
_WEBPAGE_TESTS = [{
'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continental-gt-speed-ces-guide-achat-dacia.html',
'md5': '37a6c3381599381ff53a7e1e0575c0bc',
'info_dict': {
'id': 'F_xQzS2jwb3',
'ext': 'mp4',
'title': 'Turbo du 07/09/2014 : 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,
'upload_date': str,
'timestamp': float,
}
}]
def _extract_from_webpage(self, url, webpage):
has_vously_player = get_element_html_by_class('viously-player', webpage) or get_element_html_by_class('vsly-player', webpage)
if not has_vously_player:
return
viously_players = get_elements_html_by_class('viously-player', webpage) + get_elements_html_by_class('vsly-player', webpage)
for viously_player in viously_players:
video_id = self._html_search_regex(r'id="([-_\w]+)"', viously_player, 'video_id')
title = self._html_extract_title(webpage)
yield {
'id': video_id,
'title': title,
'description': title,
'formats': self._extract_m3u8_formats(self._API_URL.format(video_id), video_id),
}