aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/filmweb.py
diff options
context:
space:
mode:
authorDéstin Reed <trox1972@users.noreply.github.com>2016-08-17 16:02:59 +0200
committerRemita Amine <remitamine@gmail.com>2017-12-26 15:19:37 +0100
commita14001a5a13b1639dc98b75b0775d251487aad1d (patch)
tree2898e9cf6d6bd54fb9a2505a3fbba4da10fc8826 /youtube_dl/extractor/filmweb.py
parentdb145ee54a57f5ccc89639de8c589eb111a91b19 (diff)
downloadyoutube-dl-a14001a5a13b1639dc98b75b0775d251487aad1d.tar.xz
[Filmweb] Add extractor
Diffstat (limited to 'youtube_dl/extractor/filmweb.py')
-rw-r--r--youtube_dl/extractor/filmweb.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/youtube_dl/extractor/filmweb.py b/youtube_dl/extractor/filmweb.py
new file mode 100644
index 000000000..a3d9f872e
--- /dev/null
+++ b/youtube_dl/extractor/filmweb.py
@@ -0,0 +1,45 @@
+from __future__ import unicode_literals
+
+from .twentythreevideo import TwentyThreeVideoIE
+
+
+class FilmwebIE(TwentyThreeVideoIE):
+ IE_NAME = 'Filmweb'
+ _VALID_URL = r'https?://(?:www\.)?filmweb\.no/trailere/article(?P<id>\d+).ece'
+ _TEST = {
+ 'url': 'http://www.filmweb.no/trailere/article1264921.ece',
+ 'md5': 'e353f47df98e557d67edaceda9dece89',
+ 'info_dict': {
+ 'id': '1264921',
+ 'title': 'Det som en gang var',
+ 'ext': 'mp4',
+ 'description': 'Trailer: Scener fra et vennskap',
+ }
+ }
+
+ _CLIENT_NAME = 'filmweb'
+ _CLIENT_ID = '12732917'
+ _EMBED_BASE_URL = 'http://www.filmweb.no/template/ajax/json_trailerEmbed.jsp?articleId=%s&autoplay=true'
+
+ def _real_extract(self, url):
+ article_id = self._match_id(url)
+ webpage = self._download_webpage(url, article_id)
+
+ title = self._search_regex(r'var\s+jsTitle\s*=\s*escape\("([^"]+)"\);',
+ webpage, 'title', fatal=True)
+
+ format_url = self._proto_relative_url(
+ self._html_search_regex(r'"(//filmweb\.23video\.com/[^"]+)"',
+ self._download_json(self._EMBED_BASE_URL % article_id,
+ article_id)['embedCode'], 'format url'))
+
+ formats = self._extract_formats(format_url, self._CLIENT_ID)
+ self._sort_formats(formats)
+
+ return {
+ 'id': article_id,
+ 'title': title,
+ 'alt_title': self._og_search_title(webpage),
+ 'formats': formats,
+ 'description': self._og_search_description(webpage),
+ }