]>
 
 
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/elpais.py 
 
 
 
 
 
 
 
 
   2  from  __future__ 
import  unicode_literals
 
   4  from  . common 
import  InfoExtractor
 
   5  from  .. utils 
import  strip_jsonp
,  unified_strdate
 
   8  class  ElPaisIE ( InfoExtractor
):  
   9      _VALID_URL 
=  r
'https?://(?:[^.]+\.)?elpais\.com/.*/(?P<id>[^/#?]+)\.html(?:$|[?#])'  
  13          'url' :  'http://blogs.elpais.com/la-voz-de-inaki/2014/02/tiempo-nuevo-recetas-viejas.html' ,  
  14          'md5' :  '98406f301f19562170ec071b83433d55' ,  
  16              'id' :  'tiempo-nuevo-recetas-viejas' ,  
  18              'title' :  'Tiempo nuevo, recetas viejas' ,  
  19              'description' :  'De lunes a viernes, a partir de las ocho de la mañana, Iñaki Gabilondo nos cuenta su visión de la actualidad nacional e internacional.' ,  
  20              'upload_date' :  '20140206' ,  
  23          'url' :  'http://elcomidista.elpais.com/elcomidista/2016/02/24/articulo/1456340311_668921.html#?id_externo_nwl=newsletter_diaria20160303t' ,  
  24          'md5' :  '3bd5b09509f3519d7d9e763179b013de' ,  
  26              'id' :  '1456340311_668921' ,  
  28              'title' :  'Cómo hacer el mejor café con cafetera italiana' ,  
  29              'description' :  'Que sí, que las cápsulas son cómodas. Pero si le pides algo más a la vida, quizá deberías aprender a usar bien la cafetera italiana. No tienes más que ver este vídeo y seguir sus siete normas básicas.' ,  
  30              'upload_date' :  '20160303' ,  
  33          'url' :  'http://elpais.com/elpais/2017/01/26/ciencia/1485456786_417876.html' ,  
  34          'md5' :  '9c79923a118a067e1a45789e1e0b0f9c' ,  
  36              'id' :  '1485456786_417876' ,  
  38              'title' :  'Hallado un barco de la antigua Roma que naufragó en Baleares hace 1.800 años' ,  
  39              'description' :  'La nave portaba cientos de ánforas y se hundió cerca de la isla de Cabrera por razones desconocidas' ,  
  40              'upload_date' :  '20170127' ,  
  43          'url' :  'http://epv.elpais.com/epv/2017/02/14/programa_la_voz_de_inaki/1487062137_075943.html' ,  
  45              'id' :  '1487062137_075943' ,  
  47              'title' :  'Disyuntivas' ,  
  48              'description' :  'md5:a0fb1485c4a6a8a917e6f93878e66218' ,  
  49              'upload_date' :  '20170214' ,  
  52              'skip_download' :  True ,  
  56      def  _real_extract ( self
,  url
):  
  57          video_id 
=  self
._ match
_ id
( url
)  
  58          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)  
  60          prefix 
=  self
._ html
_ search
_ regex
(  
  61              r
'var\s+url_cache\s*=\s*"([^"]+)";' ,  webpage
,  'URL prefix' )  
  62          id_multimedia 
=  self
._ search
_ regex
(  
  63              r
"id_multimedia\s*=\s*'([^']+)'" ,  webpage
,  'ID multimedia' ,  default
= None )  
  65              url_info 
=  self
._ download
_ json
(  
  66                  'http://elpais.com/vdpep/1/?pepid='  +  id_multimedia
,  video_id
,  transform_source
= strip_jsonp
)  
  67              video_suffix 
=  url_info
[ 'mp4' ]  
  69              video_suffix 
=  self
._ search
_ regex
(  
  70                  r
"(?:URLMediaFile|urlVideo_\d+)\s*=\s*url_cache\s*\+\s*'([^']+)'" ,  webpage
,  'video URL' )  
  71          video_url 
=  prefix 
+  video_suffix
 
  72          thumbnail_suffix 
=  self
._ search
_ regex
(  
  73              r
"(?:URLMediaStill|urlFotogramaFijo_\d+)\s*=\s*url_cache\s*\+\s*'([^']+)'" ,  
  74              webpage
,  'thumbnail URL' ,  default
= None )  
  76              None if  thumbnail_suffix 
is None  
  77              else  prefix 
+  thumbnail_suffix
)  or  self
._ og
_ search
_ thumbnail
( webpage
)  
  78          title 
=  self
._ html
_ search
_ regex
(  
  79              ( r
"tituloVideo\s*=\s*'([^']+)'" ,  
  80               r
'<h2 class="entry-header entry-title.*?>(.*?)</h2>' ,  
  81               r
'<h1[^>]+class="titulo"[^>]*>([^<]+)' ),  
  82              webpage
,  'title' ,  default
= None )  or  self
._ og
_ search
_ title
( webpage
)  
  83          upload_date 
=  unified_strdate ( self
._ search
_ regex
(  
  84              r
'<p class="date-header date-int updated"\s+title="([^"]+)">' ,  
  85              webpage
,  'upload date' ,  default
= None )  or  self
._ html
_ search
_ meta
(  
  86              'datePublished' ,  webpage
,  'timestamp' ))  
  92              'description' :  self
._ og
_ search
_ description
( webpage
),  
  93              'thumbnail' :  thumbnail
,  
  94              'upload_date' :  upload_date
,