aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2017-01-26 18:36:28 +0100
committerRemita Amine <remitamine@gmail.com>2017-01-26 18:37:22 +0100
commit9463637887ba784e3499410ab0945dcd68002bc1 (patch)
tree2ba1cca9f7bb76908e153ab7d37b370a3cc06ee3 /youtube_dl/extractor
parent3cbecdd11121b9c7ff0284e481992f7230806399 (diff)
[tva] Add new extractor(closes #11842)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/tva.py54
2 files changed, 55 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index 0c3e081ad..81366f933 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -985,6 +985,7 @@ from .tv2 import (
)
from .tv3 import TV3IE
from .tv4 import TV4IE
+from .tva import TVAIE
from .tvanouvelles import (
TVANouvellesIE,
TVANouvellesArticleIE,
diff --git a/youtube_dl/extractor/tva.py b/youtube_dl/extractor/tva.py
new file mode 100644
index 000000000..3ced098f9
--- /dev/null
+++ b/youtube_dl/extractor/tva.py
@@ -0,0 +1,54 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ smuggle_url,
+)
+
+
+class TVAIE(InfoExtractor):
+ _VALID_URL = r'https?://videos\.tva\.ca/episode/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'http://videos.tva.ca/episode/85538',
+ 'info_dict': {
+ 'id': '85538',
+ 'ext': 'mp4',
+ 'title': 'Épisode du 25 janvier 2017',
+ 'description': 'md5:e9e7fb5532ab37984d2dc87229cadf98',
+ 'upload_date': '20170126',
+ 'timestamp': 1485442329,
+ },
+ 'params': {
+ # m3u8 download
+ 'skip_download': True,
+ }
+ }
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ video_data = self._download_json(
+ "https://d18jmrhziuoi7p.cloudfront.net/isl/api/v1/dataservice/Items('%s')" % video_id,
+ video_id, query={
+ '$expand': 'Metadata,CustomId',
+ '$select': 'Metadata,Id,Title,ShortDescription,LongDescription,CreatedDate,CustomId,AverageUserRating,Categories,ShowName',
+ '$format': 'json',
+ })
+ metadata = video_data.get('Metadata', {})
+
+ return {
+ '_type': 'url_transparent',
+ 'id': video_id,
+ 'title': video_data['Title'],
+ 'url': smuggle_url('ooyala:' + video_data['CustomId'], {'supportedformats': 'm3u8,hds'}),
+ 'description': video_data.get('LongDescription') or video_data.get('ShortDescription'),
+ 'series': video_data.get('ShowName'),
+ 'episode': metadata.get('EpisodeTitle'),
+ 'episode_number': int_or_none(metadata.get('EpisodeNumber')),
+ 'categories': video_data.get('Categories'),
+ 'average_rating': video_data.get('AverageUserRating'),
+ 'timestamp': parse_iso8601(video_data.get('CreatedDate')),
+ 'ie_key': 'Ooyala',
+ }