48 lines
1.6 KiB
Python
Raw Normal View History

2016-05-27 19:25:51 +02:00
# coding: utf-8
from __future__ import unicode_literals
import re
2016-06-09 14:27:34 +02:00
from .common import InfoExtractor
2016-05-27 19:25:51 +02:00
from ..utils import (
smuggle_url,
update_url_query,
)
class EOnlineIE(InfoExtractor):
2016-06-09 14:27:34 +02:00
_VALID_URL = r'https?://(?:www\.)?eonline\.com/[a-z]{2}(?:/[a-z-]+){3}/(?P<id>[0-9]+)/(?P<display_id>[a-z-]+)'
2016-05-27 19:25:51 +02:00
_TEST = {
'url': 'http://www.eonline.com/uk/shows/botched/videos/249184/transgender-woman-takes-a-trip-to-her-past',
'md5': '1ca5b36c4337fde2b65207e0ad0c11c0',
'info_dict': {
2016-06-09 14:27:34 +02:00
'id': '249184',
2016-05-27 19:25:51 +02:00
'ext': 'mp4',
'title': 'Transgender Woman Takes a Trip to Her Past',
'description': 'md5:621feda5e84d5d4a29f4cc26faa33d24',
'timestamp': 1464364800,
'upload_date': '20160527',
2016-06-09 14:27:34 +02:00
'uploader': 'NBCU-E',
2016-05-27 19:25:51 +02:00
}
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
2016-06-09 14:27:34 +02:00
video_id, display_id = mobj.group('id', 'display_id')
2016-05-27 19:25:51 +02:00
webpage = self._download_webpage(url, display_id)
2016-06-09 14:27:34 +02:00
data = self._parse_json(self._search_regex(
r'evideo.videos.detail\s*=\s*(\[\s*\{[^\]]+]);',
webpage, 'JSON data'), display_id)
for entry in data:
if entry['id'] == video_id:
release_url = entry['videoSourceUrl']
2016-05-27 19:25:51 +02:00
return {
2016-06-09 14:27:34 +02:00
'_type': 'url_transparent',
2016-05-27 19:25:51 +02:00
'ie_key': 'ThePlatform',
2016-06-09 14:27:34 +02:00
'url': smuggle_url(update_url_query(release_url, {'mbr': True, 'switch': 'http'}), {'force_smil_url': True}),
'id': video_id,
2016-05-27 19:25:51 +02:00
'display_id': display_id,
}