2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
8 from ..utils
import js_to_json
11 class OnionStudiosIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?onionstudios\.com/(?:video(?:s/[^/]+-|/)|embed\?.*\bid=)(?P<id>\d+)(?!-)'
15 'url': 'http://www.onionstudios.com/videos/hannibal-charges-forward-stops-for-a-cocktail-2937',
16 'md5': '5a118d466d62b5cd03647cf2c593977f',
20 'title': 'Hannibal charges forward, stops for a cocktail',
21 'description': 'md5:545299bda6abf87e5ec666548c6a9448',
22 'thumbnail': r
're:^https?://.*\.jpg$',
23 'uploader': 'a.v. club',
24 'upload_date': '20150619',
25 'timestamp': 1434728546,
28 'url': 'http://www.onionstudios.com/embed?id=2855&autoplay=true',
29 'only_matching': True,
31 'url': 'http://www.onionstudios.com/video/6139.json',
32 'only_matching': True,
36 def _extract_url(webpage
):
38 r
'(?s)<(?:iframe|bulbs-video)[^>]+?src=(["\'])(?P
<url
>(?
:https?
:)?
//(?
:www\
.)?onionstudios\
.com
/(?
:embed
.+?|video
/\d
+\
.json
))\
1', webpage)
40 return mobj.group('url
')
42 def _real_extract(self, url):
43 video_id = self._match_id(url)
45 webpage = self._download_webpage(
46 'http
://onionstudios
.com
/embed
/dc94dc2899fe644c0e7241fa04c1b732
.js
',
48 mcp_id = compat_str(self._parse_json(self._search_regex(
49 r'window\
.mcpMapping\s
*=\s
*({.+?
});', webpage,
50 'MCP Mapping
'), video_id, js_to_json)[video_id]['mcp_id
'])
51 return self.url_result(
52 'http
://kinja
.com
/ajax
/inset
/iframe?
id=mcp
-' + mcp_id,