]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/kickstarter.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   7 class KickStarterIE(InfoExtractor
): 
   8     _VALID_URL 
= r
'https?://www\.kickstarter\.com/projects/(?P<id>[^/]*)/.*' 
  10         'url': 'https://www.kickstarter.com/projects/1404461844/intersection-the-story-of-josh-grant?ref=home_location', 
  11         'md5': 'c81addca81327ffa66c642b5d8b08cab', 
  15             'title': 'Intersection: The Story of Josh Grant by Kyle Cowling', 
  17                 'A unique motocross documentary that examines the ' 
  18                 'life and mind of one of sports most elite athletes: Josh Grant.' 
  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', 
  27             'uploader_id': 'pebble', 
  28             'uploader': 'Pebble Technology', 
  29             'title': 'Pebble iOS Notifications', 
  32         'url': 'https://www.kickstarter.com/projects/1420158244/power-drive-2000/widget/video.html', 
  36             'title': 'Power Drive 2000', 
  38         'expected_warnings': ['OpenGraph description'], 
  41     def _real_extract(self
, url
): 
  42         video_id 
= self
._match
_id
(url
) 
  43         webpage 
= self
._download
_webpage
(url
, video_id
) 
  45         title 
= self
._html
_search
_regex
( 
  46             r
'<title>\s*(.*?)(?:\s*— Kickstarter)?\s*</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 
  53                 '_type': 'url_transparent', 
  59         thumbnail 
= self
._og
_search
_thumbnail
(webpage
, default
=None) 
  61             thumbnail 
= self
._html
_search
_regex
( 
  62                 r
'<img[^>]+class="[^"]+\s*poster\s*[^"]+"[^>]+src="([^"]+)"', 
  63                 webpage
, 'thumbnail image', fatal
=False) 
  68             'description': self
._og
_search
_description
(webpage
), 
  69             'thumbnail': thumbnail
,