]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/filmweb.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class FilmwebIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://(?:www\.)?filmweb\.no/(?P<type>trailere|filmnytt)/article(?P<id>\d+)\.ece' 
  11         'url': 'http://www.filmweb.no/trailere/article1264921.ece', 
  12         'md5': 'e353f47df98e557d67edaceda9dece89', 
  16             'title': 'Det som en gang var', 
  17             'upload_date': '20160316', 
  18             'timestamp': 1458140101, 
  19             'uploader_id': '12639966', 
  20             'uploader': 'Live Roaldset', 
  24     def _real_extract(self
, url
): 
  25         article_type
, article_id 
= re
.match(self
._VALID
_URL
, url
).groups() 
  26         if article_type 
== 'filmnytt': 
  27             webpage 
= self
._download
_webpage
(url
, article_id
) 
  28             article_id 
= self
._search
_regex
(r
'data-videoid="(\d+)"', webpage
, 'article id') 
  29         embed_code 
= self
._download
_json
( 
  30             'https://www.filmweb.no/template_v2/ajax/json_trailerEmbed.jsp', 
  32                 'articleId': article_id
, 
  34         iframe_url 
= self
._proto
_relative
_url
(self
._search
_regex
( 
  35             r
'<iframe[^>]+src="([^"]+)', embed_code
, 'iframe url')) 
  38             '_type': 'url_transparent', 
  41             'ie_key': 'TwentyThreeVideo',