]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/kickstarter.py
Update changelog.
[youtubedl] / youtube_dl / extractor / kickstarter.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class KickStarterIE(InfoExtractor):
7 _VALID_URL = r'https?://www\.kickstarter\.com/projects/(?P<id>\d*)/.*'
8 _TEST = {
9 u"url": u"https://www.kickstarter.com/projects/1404461844/intersection-the-story-of-josh-grant?ref=home_location",
10 u"file": u"1404461844.mp4",
11 u"md5": u"c81addca81327ffa66c642b5d8b08cab",
12 u"info_dict": {
13 u"title": u"Intersection: The Story of Josh Grant by Kyle Cowling",
14 },
15 }
16
17 def _real_extract(self, url):
18 m = re.match(self._VALID_URL, url)
19 video_id = m.group('id')
20 webpage_src = self._download_webpage(url, video_id)
21
22 video_url = self._search_regex(r'data-video="(.*?)">',
23 webpage_src, u'video URL')
24 if 'mp4' in video_url:
25 ext = 'mp4'
26 else:
27 ext = 'flv'
28 video_title = self._html_search_regex(r"<title>(.*?)</title>",
29 webpage_src, u'title').rpartition(u'\u2014 Kickstarter')[0].strip()
30
31 results = [{
32 'id': video_id,
33 'url': video_url,
34 'title': video_title,
35 'ext': ext,
36 }]
37 return results