mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 02:55:17 +00:00
[mpora] Modernize
This commit is contained in:
parent
0196149c5b
commit
9158b2b301
1 changed files with 6 additions and 10 deletions
|
@ -1,21 +1,19 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import int_or_none
|
from ..utils import int_or_none
|
||||||
|
|
||||||
|
|
||||||
class MporaIE(InfoExtractor):
|
class MporaIE(InfoExtractor):
|
||||||
_VALID_URL = r'^https?://(www\.)?mpora\.(?:com|de)/videos/(?P<id>[^?#/]+)'
|
_VALID_URL = r'https?://(www\.)?mpora\.(?:com|de)/videos/(?P<id>[^?#/]+)'
|
||||||
IE_NAME = 'MPORA'
|
IE_NAME = 'MPORA'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://mpora.de/videos/AAdo8okx4wiz/embed?locale=de',
|
'url': 'http://mpora.de/videos/AAdo8okx4wiz/embed?locale=de',
|
||||||
'file': 'AAdo8okx4wiz.mp4',
|
|
||||||
'md5': 'a7a228473eedd3be741397cf452932eb',
|
'md5': 'a7a228473eedd3be741397cf452932eb',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': 'AAdo8okx4wiz',
|
||||||
|
'ext': 'mp4',
|
||||||
'title': 'Katy Curd - Winter in the Forest',
|
'title': 'Katy Curd - Winter in the Forest',
|
||||||
'duration': 416,
|
'duration': 416,
|
||||||
'uploader': 'Peter Newman Media',
|
'uploader': 'Peter Newman Media',
|
||||||
|
@ -23,14 +21,12 @@ class MporaIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m = re.match(self._VALID_URL, url)
|
video_id = self._match_id(url)
|
||||||
video_id = m.group('id')
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
data_json = self._search_regex(
|
data_json = self._search_regex(
|
||||||
r"new FM\.Player\('[^']+',\s*(\{.*?)\).player;", webpage, 'json')
|
r"new FM\.Player\('[^']+',\s*(\{.*?)\).player;", webpage, 'json')
|
||||||
|
data = self._parse_json(data_json, video_id)
|
||||||
data = json.loads(data_json)
|
|
||||||
|
|
||||||
uploader = data['info_overlay'].get('username')
|
uploader = data['info_overlay'].get('username')
|
||||||
duration = data['video']['duration'] // 1000
|
duration = data['video']['duration'] // 1000
|
||||||
|
|
Loading…
Reference in a new issue