]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/kickstarter.py
[youtube] Download DASH manifest
[yt-dlp.git] / youtube_dl / extractor / kickstarter.py
CommitLineData
f1d20fa3
JMS
1import re
2
3from .common import InfoExtractor
4
5
6class KickStarterIE(InfoExtractor):
94518f20 7 _VALID_URL = r'https?://www\.kickstarter\.com/projects/(?P<id>\d*)/.*'
f1d20fa3 8 _TEST = {
94518f20
JMF
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 },
f1d20fa3
JMS
15 }
16
f1d20fa3
JMS
17 def _real_extract(self, url):
18 m = re.match(self._VALID_URL, url)
19 video_id = m.group('id')
f1d20fa3
JMS
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')
f1d20fa3
JMS
24 if 'mp4' in video_url:
25 ext = 'mp4'
26 else:
27 ext = 'flv'
94518f20
JMF
28 video_title = self._html_search_regex(r"<title>(.*?)</title>",
29 webpage_src, u'title').rpartition(u'\u2014 Kickstarter')[0].strip()
f1d20fa3
JMS
30
31 results = [{
32 'id': video_id,
94518f20
JMF
33 'url': video_url,
34 'title': video_title,
35 'ext': ext,
f1d20fa3 36 }]
94518f20 37 return results