From ec716dde9ddd6f01d6276ef0f6a95103f62b8c7c Mon Sep 17 00:00:00 2001 From: Olivier Guerriat Date: Sun, 3 Dec 2017 13:26:24 +0100 Subject: [PATCH] [Flixel] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/flixel.py | 35 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 youtube_dl/extractor/flixel.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 2cc3bc463..847d37be1 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -352,6 +352,7 @@ from .fivemin import FiveMinIE from .fivetv import FiveTVIE from .flickr import FlickrIE from .flipagram import FlipagramIE +from .flixel import FlixelIE from .folketinget import FolketingetIE from .footyroom import FootyRoomIE from .formula1 import Formula1IE diff --git a/youtube_dl/extractor/flixel.py b/youtube_dl/extractor/flixel.py new file mode 100644 index 000000000..170407c95 --- /dev/null +++ b/youtube_dl/extractor/flixel.py @@ -0,0 +1,35 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class FlixelIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?flixel\.com/cinemagraph/(?P[0-9a-zA-Z]+)' + _TEST = { + 'url': 'https://flixel.com/cinemagraph/tg64m4fmxbqu5yrywoz5/', + 'md5': '374a8a8f8902f7db0f4a8d6f580c23ed', + 'info_dict': { + 'id': 'tg64m4fmxbqu5yrywoz5', + 'ext': 'mp4', + 'title': 'ROSSIO', + 'uploader': 'capn', + 'duration': 3.575, + 'thumbnail': 'https://cdn.flixel.com/flixel/tg64m4fmxbqu5yrywoz5.thumbnail.jpg?v=1', + 'webpage_url': 'https://flixel.com/cinemagraph/tg64m4fmxbqu5yrywoz5/', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + json_url = 'https://api.flixel.com/2/flixels/{0}'.format(video_id) + meta = self._download_json(json_url, video_id) + return { + 'id': video_id, + 'title': meta.get('caption'), + 'url': meta.get('hd_mp4'), + 'uploader': meta.get('username'), + 'duration': meta.get('duration'), + 'thumbnail': meta.get('thumbnail'), + 'webpage_url': meta.get('link'), + }