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