]>
Commit | Line | Data |
---|---|---|
f1d20fa3 | 1 | from .common import InfoExtractor |
abe694ca | 2 | from ..utils import smuggle_url |
f1d20fa3 JMS |
3 | |
4 | ||
5 | class KickStarterIE(InfoExtractor): | |
92519402 | 6 | _VALID_URL = r'https?://(?:www\.)?kickstarter\.com/projects/(?P<id>[^/]*)/.*' |
e00fc35d | 7 | _TESTS = [{ |
f021acee | 8 | 'url': 'https://www.kickstarter.com/projects/1404461844/intersection-the-story-of-josh-grant/description', |
79bfd010 JMF |
9 | 'md5': 'c81addca81327ffa66c642b5d8b08cab', |
10 | 'info_dict': { | |
11 | 'id': '1404461844', | |
12 | 'ext': 'mp4', | |
13 | 'title': 'Intersection: The Story of Josh Grant by Kyle Cowling', | |
9e1a5b84 JW |
14 | 'description': ( |
15 | 'A unique motocross documentary that examines the ' | |
16 | 'life and mind of one of sports most elite athletes: Josh Grant.' | |
17 | ), | |
94518f20 | 18 | }, |
e00fc35d PH |
19 | }, { |
20 | 'note': 'Embedded video (not using the native kickstarter video service)', | |
21 | 'url': 'https://www.kickstarter.com/projects/597507018/pebble-e-paper-watch-for-iphone-and-android/posts/659178', | |
4a6c9428 PH |
22 | 'info_dict': { |
23 | 'id': '78704821', | |
24 | 'ext': 'mp4', | |
25 | 'uploader_id': 'pebble', | |
26 | 'uploader': 'Pebble Technology', | |
27 | 'title': 'Pebble iOS Notifications', | |
abe694ca YCH |
28 | }, |
29 | 'add_ie': ['Vimeo'], | |
627b9648 YCH |
30 | }, { |
31 | 'url': 'https://www.kickstarter.com/projects/1420158244/power-drive-2000/widget/video.html', | |
32 | 'info_dict': { | |
33 | 'id': '1420158244', | |
34 | 'ext': 'mp4', | |
35 | 'title': 'Power Drive 2000', | |
36 | }, | |
e00fc35d | 37 | }] |
f1d20fa3 | 38 | |
f1d20fa3 | 39 | def _real_extract(self, url): |
4a6c9428 | 40 | video_id = self._match_id(url) |
79bfd010 | 41 | webpage = self._download_webpage(url, video_id) |
f1d20fa3 | 42 | |
e00fc35d | 43 | title = self._html_search_regex( |
f021acee | 44 | r'<title>\s*(.*?)(?:\s*—\s*Kickstarter)?\s*</title>', |
e00fc35d PH |
45 | webpage, 'title') |
46 | video_url = self._search_regex( | |
47 | r'data-video-url="(.*?)"', | |
48 | webpage, 'video URL', default=None) | |
49 | if video_url is None: # No native kickstarter, look for embedded videos | |
50 | return { | |
51 | '_type': 'url_transparent', | |
52 | 'ie_key': 'Generic', | |
abe694ca | 53 | 'url': smuggle_url(url, {'to_generic': True}), |
e00fc35d PH |
54 | 'title': title, |
55 | } | |
f1d20fa3 | 56 | |
627b9648 YCH |
57 | thumbnail = self._og_search_thumbnail(webpage, default=None) |
58 | if thumbnail is None: | |
59 | thumbnail = self._html_search_regex( | |
60 | r'<img[^>]+class="[^"]+\s*poster\s*[^"]+"[^>]+src="([^"]+)"', | |
61 | webpage, 'thumbnail image', fatal=False) | |
79bfd010 JMF |
62 | return { |
63 | 'id': video_id, | |
64 | 'url': video_url, | |
e00fc35d | 65 | 'title': title, |
08773689 | 66 | 'description': self._og_search_description(webpage, default=None), |
627b9648 | 67 | 'thumbnail': thumbnail, |
79bfd010 | 68 | } |