]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/filmweb.py
[test/cookies] Improve logging
[yt-dlp.git] / yt_dlp / extractor / filmweb.py
1 from __future__ import unicode_literals
2
3
4 from .common import InfoExtractor
5
6
7 class FilmwebIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?filmweb\.no/(?P<type>trailere|filmnytt)/article(?P<id>\d+)\.ece'
9 _TEST = {
10 'url': 'http://www.filmweb.no/trailere/article1264921.ece',
11 'md5': 'e353f47df98e557d67edaceda9dece89',
12 'info_dict': {
13 'id': '13033574',
14 'ext': 'mp4',
15 'title': 'Det som en gang var',
16 'upload_date': '20160316',
17 'timestamp': 1458140101,
18 'uploader_id': '12639966',
19 'uploader': 'Live Roaldset',
20 }
21 }
22
23 def _real_extract(self, url):
24 article_type, article_id = self._match_valid_url(url).groups()
25 if article_type == 'filmnytt':
26 webpage = self._download_webpage(url, article_id)
27 article_id = self._search_regex(r'data-videoid="(\d+)"', webpage, 'article id')
28 embed_code = self._download_json(
29 'https://www.filmweb.no/template_v2/ajax/json_trailerEmbed.jsp',
30 article_id, query={
31 'articleId': article_id,
32 })['embedCode']
33 iframe_url = self._proto_relative_url(self._search_regex(
34 r'<iframe[^>]+src="([^"]+)', embed_code, 'iframe url'))
35
36 return {
37 '_type': 'url_transparent',
38 'id': article_id,
39 'url': iframe_url,
40 'ie_key': 'TwentyThreeVideo',
41 }