]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/kickstarter.py
[YoutubeDL] Do not override ie_key in url_transparent
[yt-dlp.git] / youtube_dl / extractor / kickstarter.py
CommitLineData
79bfd010
JMF
1# encoding: utf-8
2from __future__ import unicode_literals
3
f1d20fa3
JMS
4from .common import InfoExtractor
5
6
7class KickStarterIE(InfoExtractor):
79bfd010 8 _VALID_URL = r'https?://www\.kickstarter\.com/projects/(?P<id>[^/]*)/.*'
e00fc35d 9 _TESTS = [{
79bfd010
JMF
10 'url': 'https://www.kickstarter.com/projects/1404461844/intersection-the-story-of-josh-grant?ref=home_location',
11 'md5': 'c81addca81327ffa66c642b5d8b08cab',
12 'info_dict': {
13 'id': '1404461844',
14 'ext': 'mp4',
15 'title': 'Intersection: The Story of Josh Grant by Kyle Cowling',
9e1a5b84
JW
16 'description': (
17 'A unique motocross documentary that examines the '
18 'life and mind of one of sports most elite athletes: Josh Grant.'
19 ),
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',
4a6c9428
PH
24 'info_dict': {
25 'id': '78704821',
26 'ext': 'mp4',
27 'uploader_id': 'pebble',
28 'uploader': 'Pebble Technology',
29 'title': 'Pebble iOS Notifications',
30 }
627b9648
YCH
31 }, {
32 'url': 'https://www.kickstarter.com/projects/1420158244/power-drive-2000/widget/video.html',
33 'info_dict': {
34 'id': '1420158244',
35 'ext': 'mp4',
36 'title': 'Power Drive 2000',
37 },
38 'expected_warnings': ['OpenGraph description'],
e00fc35d 39 }]
f1d20fa3 40
f1d20fa3 41 def _real_extract(self, url):
4a6c9428 42 video_id = self._match_id(url)
79bfd010 43 webpage = self._download_webpage(url, video_id)
f1d20fa3 44
e00fc35d
PH
45 title = self._html_search_regex(
46 r'<title>\s*(.*?)(?:\s*&mdash; Kickstarter)?\s*</title>',
47 webpage, 'title')
48 video_url = self._search_regex(
49 r'data-video-url="(.*?)"',
50 webpage, 'video URL', default=None)
51 if video_url is None: # No native kickstarter, look for embedded videos
52 return {
53 '_type': 'url_transparent',
54 'ie_key': 'Generic',
55 'url': url,
56 'title': title,
57 }
f1d20fa3 58
627b9648
YCH
59 thumbnail = self._og_search_thumbnail(webpage, default=None)
60 if thumbnail is None:
61 thumbnail = self._html_search_regex(
62 r'<img[^>]+class="[^"]+\s*poster\s*[^"]+"[^>]+src="([^"]+)"',
63 webpage, 'thumbnail image', fatal=False)
79bfd010
JMF
64 return {
65 'id': video_id,
66 'url': video_url,
e00fc35d 67 'title': title,
79bfd010 68 'description': self._og_search_description(webpage),
627b9648 69 'thumbnail': thumbnail,
79bfd010 70 }