2019-10-28 18:45:42 +00:00
|
|
|
import json
|
|
|
|
import re
|
|
|
|
|
2013-10-12 19:34:04 +00:00
|
|
|
from .common import InfoExtractor
|
2021-08-22 19:02:00 +00:00
|
|
|
from ..utils import parse_qs
|
2013-10-12 19:34:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class InternetVideoArchiveIE(InfoExtractor):
|
2016-04-09 13:46:51 +00:00
|
|
|
_VALID_URL = r'https?://video\.internetvideoarchive\.net/(?:player|flash/players)/.*?\?.*?publishedid.*?'
|
2013-10-12 19:34:04 +00:00
|
|
|
|
|
|
|
_TEST = {
|
2016-04-09 13:46:51 +00:00
|
|
|
'url': 'http://video.internetvideoarchive.net/player/6/configuration.ashx?customerid=69249&publishedid=194487&reporttag=vdbetatitle&playerid=641&autolist=0&domain=www.videodetective.com&maxrate=high&minrate=low&socialplayer=false',
|
2014-09-29 10:23:52 +00:00
|
|
|
'info_dict': {
|
2016-04-09 13:46:51 +00:00
|
|
|
'id': '194487',
|
2014-09-29 10:23:52 +00:00
|
|
|
'ext': 'mp4',
|
2019-10-28 18:45:42 +00:00
|
|
|
'title': 'Kick-Ass 2',
|
2016-04-09 13:46:51 +00:00
|
|
|
'description': 'md5:c189d5b7280400630a1d3dd17eaa8d8a',
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
# m3u8 download
|
|
|
|
'skip_download': True,
|
2013-10-12 19:34:04 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
@staticmethod
|
2016-04-09 13:46:51 +00:00
|
|
|
def _build_json_url(query):
|
|
|
|
return 'http://video.internetvideoarchive.net/player/6/configuration.ashx?' + query
|
2013-10-12 19:34:04 +00:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2021-08-22 19:02:00 +00:00
|
|
|
query = parse_qs(url)
|
2019-10-28 18:45:42 +00:00
|
|
|
video_id = query['publishedid'][0]
|
|
|
|
data = self._download_json(
|
|
|
|
'https://video.internetvideoarchive.net/videojs7/videojs7.ivasettings.ashx',
|
|
|
|
video_id, data=json.dumps({
|
|
|
|
'customerid': query['customerid'][0],
|
|
|
|
'publishedid': video_id,
|
|
|
|
}).encode())
|
|
|
|
title = data['Title']
|
|
|
|
formats = self._extract_m3u8_formats(
|
|
|
|
data['VideoUrl'], video_id, 'mp4',
|
|
|
|
'm3u8_native', m3u8_id='hls', fatal=False)
|
|
|
|
file_url = formats[0]['url']
|
|
|
|
if '.ism/' in file_url:
|
|
|
|
replace_url = lambda x: re.sub(r'\.ism/[^?]+', '.ism/' + x, file_url)
|
|
|
|
formats.extend(self._extract_f4m_formats(
|
|
|
|
replace_url('.f4m'), video_id, f4m_id='hds', fatal=False))
|
|
|
|
formats.extend(self._extract_mpd_formats(
|
|
|
|
replace_url('.mpd'), video_id, mpd_id='dash', fatal=False))
|
|
|
|
formats.extend(self._extract_ism_formats(
|
|
|
|
replace_url('Manifest'), video_id, ism_id='mss', fatal=False))
|
|
|
|
self._sort_formats(formats)
|
2013-10-12 19:34:04 +00:00
|
|
|
|
2013-10-21 13:07:33 +00:00
|
|
|
return {
|
2013-10-12 19:34:04 +00:00
|
|
|
'id': video_id,
|
2016-04-09 13:46:51 +00:00
|
|
|
'title': title,
|
2013-10-12 19:34:04 +00:00
|
|
|
'formats': formats,
|
2019-10-28 18:45:42 +00:00
|
|
|
'thumbnail': data.get('PosterUrl'),
|
|
|
|
'description': data.get('Description'),
|
2013-10-12 19:34:04 +00:00
|
|
|
}
|