2015-06-24 19:12:13 +02:00
|
|
|
from .common import InfoExtractor
|
2019-11-06 19:56:10 +01:00
|
|
|
from ..utils import js_to_json
|
2015-06-24 19:12:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
class OnionStudiosIE(InfoExtractor):
|
2017-10-12 18:05:25 +02:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?onionstudios\.com/(?:video(?:s/[^/]+-|/)|embed\?.*\bid=)(?P<id>\d+)(?!-)'
|
2022-08-01 03:23:25 +02:00
|
|
|
_EMBED_REGEX = [r'(?s)<(?:iframe|bulbs-video)[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?onionstudios\.com/(?:embed.+?|video/\d+\.json))\1']
|
2015-06-24 19:12:13 +02:00
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://www.onionstudios.com/videos/hannibal-charges-forward-stops-for-a-cocktail-2937',
|
2019-11-06 10:44:19 +01:00
|
|
|
'md5': '5a118d466d62b5cd03647cf2c593977f',
|
2015-06-24 19:12:13 +02:00
|
|
|
'info_dict': {
|
2019-11-06 19:56:10 +01:00
|
|
|
'id': '3459881',
|
2015-06-24 19:12:13 +02:00
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Hannibal charges forward, stops for a cocktail',
|
2019-11-06 10:44:19 +01:00
|
|
|
'description': 'md5:545299bda6abf87e5ec666548c6a9448',
|
2017-01-02 13:08:07 +01:00
|
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
2019-11-06 10:44:19 +01:00
|
|
|
'uploader': 'a.v. club',
|
|
|
|
'upload_date': '20150619',
|
|
|
|
'timestamp': 1434728546,
|
2015-06-24 19:12:13 +02:00
|
|
|
},
|
|
|
|
}, {
|
|
|
|
'url': 'http://www.onionstudios.com/embed?id=2855&autoplay=true',
|
|
|
|
'only_matching': True,
|
2017-10-12 18:05:25 +02:00
|
|
|
}, {
|
|
|
|
'url': 'http://www.onionstudios.com/video/6139.json',
|
|
|
|
'only_matching': True,
|
2015-06-24 19:12:13 +02:00
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
2019-11-06 10:44:19 +01:00
|
|
|
webpage = self._download_webpage(
|
|
|
|
'http://onionstudios.com/embed/dc94dc2899fe644c0e7241fa04c1b732.js',
|
|
|
|
video_id)
|
2024-06-12 01:09:58 +02:00
|
|
|
mcp_id = str(self._parse_json(self._search_regex(
|
2019-11-06 10:44:19 +01:00
|
|
|
r'window\.mcpMapping\s*=\s*({.+?});', webpage,
|
|
|
|
'MCP Mapping'), video_id, js_to_json)[video_id]['mcp_id'])
|
2019-11-06 19:56:10 +01:00
|
|
|
return self.url_result(
|
|
|
|
'http://kinja.com/ajax/inset/iframe?id=mcp-' + mcp_id,
|
|
|
|
'KinjaEmbed', mcp_id)
|