mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-05-13 17:17:31 +00:00
[infomaniak] Add new extractor
This commit is contained in:
parent
6fece0a96b
commit
562ab2cd47
@ -513,6 +513,7 @@ from .imgur import (
|
|||||||
from .ina import InaIE
|
from .ina import InaIE
|
||||||
from .inc import IncIE
|
from .inc import IncIE
|
||||||
from .indavideo import IndavideoEmbedIE
|
from .indavideo import IndavideoEmbedIE
|
||||||
|
from .infomaniak import InfomaniakVOD2IE
|
||||||
from .infoq import InfoQIE
|
from .infoq import InfoQIE
|
||||||
from .instagram import (
|
from .instagram import (
|
||||||
InstagramIE,
|
InstagramIE,
|
||||||
|
53
youtube_dl/extractor/infomaniak.py
Normal file
53
youtube_dl/extractor/infomaniak.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
class InfomaniakVOD2IE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://player\.vod2\.infomaniak\.com/embed/(?P<id>[^/?#&]+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://player.vod2.infomaniak.com/embed/1jhvl2uq7kr4y',
|
||||||
|
'md5': 'd06fb3fc5a8d7cb4d6e4a0f4e7c5a76a',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1jhvl2uq7kr4y',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'RolandCarey2016-05-04.mp4',
|
||||||
|
'description': '',
|
||||||
|
'thumbnail': 'https://res.vod2.infomaniak.com/1/vod/thumbnail/1jhvl2uq8yqqv.jpg',
|
||||||
|
'duration': 221,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
# no useful data in given url, formatted url below reveals json data
|
||||||
|
data_url = "https://res.vod2.infomaniak.com/{}/vod/share/{}".format(video_id[0], video_id)
|
||||||
|
webpage = self._download_webpage(data_url, video_id)
|
||||||
|
|
||||||
|
data = json.loads(webpage)['data']['media'][0]
|
||||||
|
|
||||||
|
url = data['source']['url']
|
||||||
|
title = data['title']
|
||||||
|
description = ''
|
||||||
|
thumbnail = data['image']['url']
|
||||||
|
duration = data['duration']
|
||||||
|
|
||||||
|
video_mimetype = data['source']['mimetype']
|
||||||
|
|
||||||
|
info_dict = {
|
||||||
|
'id': video_id,
|
||||||
|
'url': url,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
}
|
||||||
|
|
||||||
|
# if file is m3u8
|
||||||
|
if video_mimetype == 'application/x-mpegurl':
|
||||||
|
info_dict['protocol'] = 'm3u8_native'
|
||||||
|
info_dict['manifest_url'] = url
|
||||||
|
|
||||||
|
return info_dict
|
Loading…
x
Reference in New Issue
Block a user