1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..utils import unified_strdate
10 class TheChiveIE(InfoExtractor):
11 _VALID_URL = r'http://(www\.)?thechive\.com/[^/]+/[^/]+/[^/]+/(?P<video_id>[A-Za-z\-]+)'
13 'url': "http://thechive.com/2015/02/20/so-thats-what-a-set-of-redneck-bagpipes-sound-like-video/",
14 'md5': "366710dda77cfa727bdef3523ba8466f",
16 'id': "so-thats-what-a-set-of-redneck-bagpipes-sound-like-video",
17 'title': "So that's what a set of redneck bagpipes sound like... (Video)",
18 'description': "Okay that was pretty good. Now play Freebird!...",
19 'thumbnail': "https://thechive.files.wordpress.com/2015/02/0_07dghz0w-thumbnail2.jpg",
21 'upload_date': "20150220",
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('video_id')
29 webpage = self._download_webpage(url, video_id)
31 title = self._og_search_title(webpage)
32 description = self._html_search_regex(r'(?s)<meta name="description" content="(.*?)" />', webpage, 'description')
33 thumbnail = self._og_search_thumbnail(webpage)
34 author = self._html_search_regex(
35 r'(?s)itemprop="author">(.+?)</span>', webpage, 'author', fatal=False).capitalize()
36 upload_date = unified_strdate(self._html_search_regex(
37 r'(?s)itemprop="datePublished" datetime="(.+?)">', webpage, 'upload_date', fatal=False))
39 # Adapted from extractor/musicvault.py
40 VIDEO_URL_TEMPLATE = 'http://cdnapi.kaltura.com/p/%(uid)s/sp/%(wid)s/playManifest/entryId/%(entry_id)s/format/url/protocol/http'
42 kaltura_id = self._search_regex(
44 webpage, 'kaltura ID')
45 video_url = VIDEO_URL_TEMPLATE % {
46 'entry_id': kaltura_id,
47 'wid': self._search_regex(r'partner_id/([0-9]+)\?', webpage, 'wid'),
48 'uid': self._search_regex(r'uiconf_id/([0-9]+)/', webpage, 'uid'),
55 'description': description,
56 'thumbnail': thumbnail,
58 'upload_date': upload_date,