2016-02-26 13:31:52 +01:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2016-02-27 18:06:38 +01:00
|
|
|
|
2016-02-26 13:31:52 +01:00
|
|
|
|
|
|
|
class CloserToTruthIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'http?://(?:www\.)?closertotruth\.com/series/\S+#video-(?P<id>\w+)'
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://closertotruth.com/series/solutions-the-mind-body-problem#video-3688',
|
|
|
|
'md5': '2aa5b8971633d86fe32152827846a5b4',
|
|
|
|
'info_dict': {
|
2016-02-27 18:06:38 +01:00
|
|
|
'id': '0_zh2b6eqr',
|
2016-02-26 13:31:52 +01:00
|
|
|
'ext': 'mov',
|
2016-02-27 18:06:38 +01:00
|
|
|
'title': 'ZimDe-010-S',
|
|
|
|
'upload_date': '20140307',
|
|
|
|
'timestamp': 1394236392,
|
|
|
|
'uploader_id': 'CTTXML'
|
2016-02-26 13:31:52 +01:00
|
|
|
}
|
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2016-02-27 18:06:38 +01:00
|
|
|
|
2016-02-26 13:31:52 +01:00
|
|
|
video_title = self._search_regex(r'<title>(.+) \|.+</title>', webpage, 'video title')
|
|
|
|
|
2016-02-27 18:06:38 +01:00
|
|
|
entry_id = self._search_regex(r'<a href="\S+" id="video-' + video_id + '" data-kaltura="(\w+)">.+<span.+<\/a>', webpage, "video entry_id")
|
|
|
|
interviewee_name = re.sub(r'(<[^>]+>)', '', self._search_regex(r'<a href="\S+" id="video-' + video_id + '" data-kaltura="\w+">(.+)<span.+<\/a>', webpage, "video interviewee_name"))
|
2016-02-26 13:31:52 +01:00
|
|
|
|
|
|
|
video_title = video_title + ' - ' + interviewee_name
|
|
|
|
|
2016-02-27 18:06:38 +01:00
|
|
|
# extract the partner id for kaltura.com
|
2016-02-26 13:31:52 +01:00
|
|
|
p_id = self._search_regex(r'<script src="http://cdnapi\.kaltura\.com/p/(?P<p>\w+)/sp/\w+/\S+/partner_id/\w+"></script>', webpage, "kaltura partner_id")
|
2016-02-27 18:06:38 +01:00
|
|
|
|
|
|
|
return self.url_result('kaltura:%s:%s' % (p_id, entry_id), 'Kaltura', entry_id, video_title)
|