-# coding: utf-8
-from __future__ import unicode_literals
-
import re
from .common import InfoExtractor
'params': {
'skip_download': True,
},
+ }, {
+ # video_type == 'video/dash'
+ 'url': 'https://www.vvvvid.it/show/683/made-in-abyss/1542/693786/nanachi',
+ 'info_dict': {
+ 'id': '693786',
+ 'ext': 'mp4',
+ 'title': 'Nanachi',
+ },
+ 'params': {
+ 'skip_download': True,
+ 'format': 'mp4',
+ },
}, {
'url': 'https://www.vvvvid.it/show/434/perche-dovrei-guardarlo-di-dario-moccia/437/489048',
'only_matching': True
'https://www.vvvvid.it/user/login',
None, headers=self.geo_verification_headers())['data']['conn_id']
- def _download_info(self, show_id, path, video_id, fatal=True):
+ def _download_info(self, show_id, path, video_id, fatal=True, query=None):
+ q = {
+ 'conn_id': self._conn_id,
+ }
+ if query:
+ q.update(query)
response = self._download_json(
'https://www.vvvvid.it/vvvvid/ondemand/%s/%s' % (show_id, path),
- video_id, headers=self.geo_verification_headers(), query={
- 'conn_id': self._conn_id,
- }, fatal=fatal)
+ video_id, headers=self.geo_verification_headers(), query=q, fatal=fatal)
if not (response or fatal):
return
if response.get('result') == 'error':
}
def _real_extract(self, url):
- show_id, season_id, video_id = re.match(self._VALID_URL, url).groups()
+ show_id, season_id, video_id = self._match_valid_url(url).groups()
response = self._download_info(
- show_id, 'season/%s' % season_id, video_id)
+ show_id, 'season/%s' % season_id,
+ video_id, query={'video_id': video_id})
vid = int(video_id)
video_data = list(filter(
if not embed_code:
continue
embed_code = ds(embed_code)
- if video_type in ('video/rcs', 'video/kenc'):
- if video_type == 'video/kenc':
- kenc = self._download_json(
- 'https://www.vvvvid.it/kenc', video_id, query={
- 'action': 'kt',
- 'conn_id': self._conn_id,
- 'url': embed_code,
- }, fatal=False) or {}
- kenc_message = kenc.get('message')
- if kenc_message:
- embed_code += '?' + ds(kenc_message)
+ if video_type == 'video/kenc':
+ embed_code = re.sub(r'https?(://[^/]+)/z/', r'https\1/i/', embed_code).replace('/manifest.f4m', '/master.m3u8')
+ kenc = self._download_json(
+ 'https://www.vvvvid.it/kenc', video_id, query={
+ 'action': 'kt',
+ 'conn_id': self._conn_id,
+ 'url': embed_code,
+ }, fatal=False) or {}
+ kenc_message = kenc.get('message')
+ if kenc_message:
+ embed_code += '?' + ds(kenc_message)
+ formats.extend(self._extract_m3u8_formats(
+ embed_code, video_id, 'mp4', m3u8_id='hls', fatal=False))
+ elif video_type == 'video/rcs':
formats.extend(self._extract_akamai_formats(embed_code, video_id))
elif video_type == 'video/youtube':
info.update({
})
is_youtube = True
break
+ elif video_type == 'video/dash':
+ formats.extend(self._extract_m3u8_formats(
+ embed_code, video_id, 'mp4', m3u8_id='hls', fatal=False))
else:
formats.extend(self._extract_wowza_formats(
'http://sb.top-ix.org/videomg/_definst_/mp4:%s/playlist.m3u8' % embed_code, video_id))
metadata_from_url(embed_code)
if not is_youtube:
- self._sort_formats(formats)
info['formats'] = formats
metadata_from_url(video_data.get('thumbnail'))
return info
-class VVVVIDShowIE(VVVVIDIE):
+class VVVVIDShowIE(VVVVIDIE): # XXX: Do not subclass from concrete IE
_VALID_URL = r'(?P<base_url>%s(?P<id>\d+)(?:/(?P<show_title>[^/?&#]+))?)/?(?:[?#&]|$)' % VVVVIDIE._VALID_URL_BASE
_TESTS = [{
'url': 'https://www.vvvvid.it/show/156/psyco-pass',
}]
def _real_extract(self, url):
- base_url, show_id, show_title = re.match(self._VALID_URL, url).groups()
+ base_url, show_id, show_title = self._match_valid_url(url).groups()
seasons = self._download_info(
show_id, 'seasons/', show_title)
show_info = self._download_info(
show_id, 'info/', show_title, fatal=False)
+ if not show_title:
+ base_url += "/title"
+
entries = []
for season in (seasons or []):
episodes = season.get('episodes') or []
+ playlist_title = season.get('name') or show_info.get('title')
for episode in episodes:
if episode.get('playable') is False:
continue
continue
info = self._extract_common_video_info(episode)
info.update({
- '_type': 'url',
+ '_type': 'url_transparent',
'ie_key': VVVVIDIE.ie_key(),
'url': '/'.join([base_url, season_id, video_id]),
'title': episode.get('title'),
'description': episode.get('description'),
'season_id': season_id,
+ 'playlist_title': playlist_title,
})
entries.append(info)