]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/kickstarter.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..utils 
import smuggle_url
 
   8 class KickStarterIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://(?:www\.)?kickstarter\.com/projects/(?P<id>[^/]*)/.*' 
  11         'url': 'https://www.kickstarter.com/projects/1404461844/intersection-the-story-of-josh-grant/description', 
  12         'md5': 'c81addca81327ffa66c642b5d8b08cab', 
  16             'title': 'Intersection: The Story of Josh Grant by Kyle Cowling', 
  18                 'A unique motocross documentary that examines the ' 
  19                 'life and mind of one of sports most elite athletes: Josh Grant.' 
  23         'note': 'Embedded video (not using the native kickstarter video service)', 
  24         'url': 'https://www.kickstarter.com/projects/597507018/pebble-e-paper-watch-for-iphone-and-android/posts/659178', 
  28             'uploader_id': 'pebble', 
  29             'uploader': 'Pebble Technology', 
  30             'title': 'Pebble iOS Notifications', 
  34         'url': 'https://www.kickstarter.com/projects/1420158244/power-drive-2000/widget/video.html', 
  38             'title': 'Power Drive 2000', 
  42     def _real_extract(self
, url
): 
  43         video_id 
= self
._match
_id
(url
) 
  44         webpage 
= self
._download
_webpage
(url
, video_id
) 
  46         title 
= self
._html
_search
_regex
( 
  47             r
'<title>\s*(.*?)(?:\s*—\s*Kickstarter)?\s*</title>', 
  49         video_url 
= self
._search
_regex
( 
  50             r
'data-video-url="(.*?)"', 
  51             webpage
, 'video URL', default
=None) 
  52         if video_url 
is None:  # No native kickstarter, look for embedded videos 
  54                 '_type': 'url_transparent', 
  56                 'url': smuggle_url(url
, {'to_generic': True}), 
  60         thumbnail 
= self
._og
_search
_thumbnail
(webpage
, default
=None) 
  62             thumbnail 
= self
._html
_search
_regex
( 
  63                 r
'<img[^>]+class="[^"]+\s*poster\s*[^"]+"[^>]+src="([^"]+)"', 
  64                 webpage
, 'thumbnail image', fatal
=False) 
  69             'description': self
._og
_search
_description
(webpage
, default
=None), 
  70             'thumbnail': thumbnail
,