]>
 
 
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sztvhu.py 
 
 
 
 
 
 
 
 
   1  # -*- coding: utf-8 -*-  
   5  from  . common 
import  InfoExtractor
 
   6  from  .. utils 
import  determine_ext
 
   9  class  SztvHuIE ( InfoExtractor
):  
  10      _VALID_URL 
=  r
'(?:http://)?(?:(?:www\.)?sztv\.hu|www\.tvszombathely\.hu)/(?:[^/]+)/.+-(?P<id>[0-9]+)'  
  12          u
'url' :  u
'http://sztv.hu/hirek/cserkeszek-nepszerusitettek-a-kornyezettudatos-eletmodot-a-savaria-teren-20130909' ,  
  13          u
'file' :  u
'20130909.mp4' ,  
  14          u
'md5' :  u
'a6df607b11fb07d0e9f2ad94613375cb' ,  
  16              u
"title" :  u
"Cserkészek népszerűsítették a környezettudatos életmódot a Savaria téren" ,  
  17              u
"description" :  u
'A zöld nap játékos ismeretterjesztő programjait a Magyar Cserkész Szövetség szervezte, akik az ország nyolc városában adják át tudásukat az érdeklődőknek. A PET...' ,  
  21      def  _real_extract ( self
,  url
):  
  22          mobj 
=  re
. match ( self
._ VALID
_U RL
,  url
)  
  23          video_id 
=  mobj
. group ( 'id' )  
  24          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)  
  25          video_file 
=  self
._ search
_ regex
(  
  26              r
'file: "...:(.*?)",' ,  webpage
,  'video file' )  
  27          title 
=  self
._ html
_ search
_ regex
(  
  28              r
'<meta name="title" content="([^"]*?) - [^-]*? - [^-]*?"' ,  
  29              webpage
,  'video title' )  
  30          description 
=  self
._ html
_ search
_ regex
(  
  31              r
'<meta name="description" content="([^"]*)"/>' ,  
  32              webpage
,  'video description' ,  fatal
= False )  
  33          thumbnail 
=  self
._ og
_ search
_ thumbnail
( webpage
)  
  35          video_url 
=  'http://media.sztv.hu/vod/'  +  video_file
 
  41              'ext' :  determine_ext ( video_url
),  
  42              'description' :  description
,  
  43              'thumbnail' :  thumbnail
,