]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/screencast.py
   1 # -*- coding: utf-8 -*- 
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  14 class ScreencastIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'https?://www\.screencast\.com/t/(?P<id>[a-zA-Z0-9]+)' 
  17         'url': 'http://www.screencast.com/t/3ZEjQXlT', 
  18         'md5': '917df1c13798a3e96211dd1561fded83', 
  22             'title': 'Color Measurement with Ocean Optics Spectrometers', 
  23             'description': 'md5:240369cde69d8bed61349a199c5fb153', 
  24             'thumbnail': 're:^https?://.*\.(?:gif|jpg)$', 
  27         'url': 'http://www.screencast.com/t/V2uXehPJa1ZI', 
  28         'md5': 'e8e4b375a7660a9e7e35c33973410d34', 
  32             'title': 'The Amadeus Spectrometer', 
  33             'description': 're:^In this video, our friends at.*To learn more about Amadeus, visit', 
  34             'thumbnail': 're:^https?://.*\.(?:gif|jpg)$', 
  37         'url': 'http://www.screencast.com/t/aAB3iowa', 
  38         'md5': 'dedb2734ed00c9755761ccaee88527cd', 
  42             'title': 'Google Earth Export', 
  43             'description': 'Provides a demo of a CommunityViz export to Google Earth, one of the 3D viewing options.', 
  44             'thumbnail': 're:^https?://.*\.(?:gif|jpg)$', 
  47         'url': 'http://www.screencast.com/t/X3ddTrYh', 
  48         'md5': '669ee55ff9c51988b4ebc0877cc8b159', 
  52             'title': 'Toolkit 6 User Group Webinar (2014-03-04) - Default Judgment and First Impression', 
  53             'description': 'md5:7b9f393bc92af02326a5c5889639eab0', 
  54             'thumbnail': 're:^https?://.*\.(?:gif|jpg)$', 
  59     def _real_extract(self
, url
): 
  60         video_id 
= self
._match
_id
(url
) 
  61         webpage 
= self
._download
_webpage
(url
, video_id
) 
  63         video_url 
= self
._html
_search
_regex
( 
  64             r
'<embed name="Video".*?src="([^"]+)"', webpage
, 
  65             'QuickTime embed', default
=None) 
  68             flash_vars_s 
= self
._html
_search
_regex
( 
  69                 r
'<param name="flashVars" value="([^"]+)"', webpage
, 'flash vars', 
  72                 flash_vars_s 
= self
._html
_search
_regex
( 
  73                     r
'<param name="initParams" value="([^"]+)"', webpage
, 'flash vars', 
  76                     flash_vars_s 
= flash_vars_s
.replace(',', '&') 
  78                 flash_vars 
= compat_parse_qs(flash_vars_s
) 
  79                 video_url_raw 
= compat_urllib_request
.quote( 
  80                     flash_vars
['content'][0]) 
  81                 video_url 
= video_url_raw
.replace('http%3A', 'http:') 
  84             video_meta 
= self
._html
_search
_meta
( 
  85                 'og:video', webpage
, default
=None) 
  87                 video_url 
= self
._search
_regex
( 
  88                     r
'src=(.*?)(?:$|&)', video_meta
, 
  89                     'meta tag video URL', default
=None) 
  92             raise ExtractorError('Cannot find video') 
  94         title 
= self
._og
_search
_title
(webpage
, default
=None) 
  96             title 
= self
._html
_search
_regex
( 
  97                 [r
'<b>Title:</b> ([^<]*)</div>', 
  98                  r
'class="tabSeperator">></span><span class="tabText">(.*?)<'], 
 100         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
 101         description 
= self
._og
_search
_description
(webpage
, default
=None) 
 102         if description 
is None: 
 103             description 
= self
._html
_search
_meta
('description', webpage
) 
 109             'description': description
, 
 110             'thumbnail': thumbnail
,