mirror of
https://github.com/l1ving/youtube-dl
synced 2025-01-27 14:05:17 +08:00
Improved regexes and returns info dict now.
This commit is contained in:
parent
0b6645fdb5
commit
29331a4d18
@ -7,7 +7,7 @@ from .common import InfoExtractor
|
||||
|
||||
|
||||
class CloserToTruthIE(InfoExtractor):
|
||||
_VALID_URL = r'http?://(?:www\.)?closertotruth\.com/series/\S+#video-(?P<id>\w+)'
|
||||
_VALID_URL = r'https?://(?:www\.)?closertotruth\.com/series/[^#]+#video-(?P<id>\w+)'
|
||||
_TESTS = [{
|
||||
'url': 'http://closertotruth.com/series/solutions-the-mind-body-problem#video-3688',
|
||||
'md5': '2aa5b8971633d86fe32152827846a5b4',
|
||||
@ -27,12 +27,17 @@ class CloserToTruthIE(InfoExtractor):
|
||||
|
||||
video_title = self._search_regex(r'<title>(.+) \|.+</title>', webpage, 'video title')
|
||||
|
||||
entry_id = self._search_regex(r'<a href="\S+" id="video-' + video_id + '" data-kaltura="(\w+)">.+<span.+<\/a>', webpage, "video entry_id")
|
||||
entry_id = self._search_regex(r'<a[^>]+id="video-%s"[^>]+data-kaltura="([^"]+)' % video_id, 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"))
|
||||
|
||||
video_title = video_title + ' - ' + interviewee_name
|
||||
|
||||
# extract the partner id for kaltura.com
|
||||
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")
|
||||
p_id = self._search_regex(r'<script[^>]+src=["\'].+?partner_id/(\d+)', webpage, "kaltura partner_id")
|
||||
|
||||
return self.url_result('kaltura:%s:%s' % (p_id, entry_id), 'Kaltura', entry_id, video_title)
|
||||
return {
|
||||
'_type': 'url_transparent',
|
||||
'id': entry_id,
|
||||
'url': 'kaltura:%s:%s' % (p_id, entry_id),
|
||||
'ie_key': 'Kaltura',
|
||||
'title': video_title
|
||||
}
|
Loading…
Reference in New Issue
Block a user