[yle-dl] Add yle-dl based extractor for areena.yle.fi
This commit is contained in:
parent
a4ed50bb84
commit
2ca292972c
@ -1460,6 +1460,7 @@ from .yapfiles import YapFilesIE
|
|||||||
from .yesjapan import YesJapanIE
|
from .yesjapan import YesJapanIE
|
||||||
from .yinyuetai import YinYueTaiIE
|
from .yinyuetai import YinYueTaiIE
|
||||||
from .ynet import YnetIE
|
from .ynet import YnetIE
|
||||||
|
from .yledl import YleDLIE
|
||||||
from .youjizz import YouJizzIE
|
from .youjizz import YouJizzIE
|
||||||
from .youku import (
|
from .youku import (
|
||||||
YoukuIE,
|
YoukuIE,
|
||||||
|
69
youtube_dl/extractor/yledl.py
Normal file
69
youtube_dl/extractor/yledl.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import subprocess
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class YleDLIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:areena|arenan).yle.fi/(?P<id>[0-9]-[0-9]+)'
|
||||||
|
_GEO_COUNTRIES = ['FI']
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://areena.yle.fi/1-4256816',
|
||||||
|
'md5': 'b9658c5960a8c2ca4ba8f1b0ff079df2',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1_iq074q8b',
|
||||||
|
'ext': 'mxf',
|
||||||
|
'title': 'Luottomies | Luottomies jouluspeciaali',
|
||||||
|
'description':
|
||||||
|
'Tommia harmittaa kun sukulaiset ovat tulossa pilaamaan '
|
||||||
|
'mukavan perhejoulun. Muuttuuko mieli isosta yllätyksestä? '
|
||||||
|
'Joulun erikoisjakson on ohjannut Jalmari Helander.',
|
||||||
|
'upload_date': '20171207',
|
||||||
|
'height': 1080,
|
||||||
|
'width': 1920,
|
||||||
|
'fps': 25,
|
||||||
|
'duration': 1302,
|
||||||
|
'timestamp': 1512633989,
|
||||||
|
'extractor': 'Kaltura',
|
||||||
|
'uploader_id': 'ovp@yle.fi',
|
||||||
|
'webpage_url_basename': '1-4256816',
|
||||||
|
'webpage_url': 'https://areena.yle.fi/1-4256816'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
props = {}
|
||||||
|
|
||||||
|
# Get essential data
|
||||||
|
props['id'] = self._match_id(url)
|
||||||
|
|
||||||
|
cp = subprocess.run(["yle-dl", "-q", "--showmetadata", url], capture_output=True, encoding='utf-8')
|
||||||
|
cp.check_returncode()
|
||||||
|
yledl = json.loads(cp.stdout)[0]
|
||||||
|
|
||||||
|
props['title'] = yledl.get('title', '<none>')
|
||||||
|
description = yledl.get('description', None)
|
||||||
|
if description:
|
||||||
|
props['description'] = description
|
||||||
|
|
||||||
|
ysubs = yledl.get('subtitles', [])
|
||||||
|
subtitles = {}
|
||||||
|
for s in ysubs:
|
||||||
|
subtitles[s['language']] = [{'url': s['url']}]
|
||||||
|
props['subtitles'] = subtitles
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for f in yledl.get('flavors', []):
|
||||||
|
formats.append({
|
||||||
|
'url': f.get('url', ""),
|
||||||
|
'tbr': f.get('bitrate', None),
|
||||||
|
'width': f.get('width', None),
|
||||||
|
'height': f.get('height', None),
|
||||||
|
'protocol': 'm3u8',
|
||||||
|
})
|
||||||
|
props['formats'] = formats
|
||||||
|
|
||||||
|
return props
|
Loading…
x
Reference in New Issue
Block a user