Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EOnline] Add new extractor (Closes #6198) #9611

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions youtube_dl/extractor/eonline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,46 @@
from __future__ import unicode_literals

import re
from .common import InfoExtractor

from .common import InfoExtractor
from ..utils import (
smuggle_url,
update_url_query,
)

class EOnlineIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?eonline\.com/[a-z]{2}(?:/[a-z-]+){3}/[0-9]+/(?P<display_id>[a-z-]+)'
_VALID_URL = r'https?://(?:www\.)?eonline\.com/[a-z]{2}(?:/[a-z-]+){3}/(?P<id>[0-9]+)/(?P<display_id>[a-z-]+)'
_TEST = {
'url': 'http://www.eonline.com/uk/shows/botched/videos/249184/transgender-woman-takes-a-trip-to-her-past',
'md5': '1ca5b36c4337fde2b65207e0ad0c11c0',
'info_dict': {
'id': 'C872_ktn4Rgc',
'id': '249184',
'ext': 'mp4',
'title': 'Transgender Woman Takes a Trip to Her Past',
'description': 'md5:621feda5e84d5d4a29f4cc26faa33d24',
'timestamp': 1464364800,
'upload_date': '20160527',
'uploader': 'NBCU-E',
'uploader': 'NBCU-E',
}
}

def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
display_id = mobj.group('display_id')
video_id, display_id = mobj.group('id', 'display_id')
webpage = self._download_webpage(url, display_id)

release_url = self._search_regex(r'"videoSourceUrl"\s*:\s*"(.+)"',
webpage, 'ThePlatform ID')
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']

return {
'_type': 'url_transparent',
'_type': 'url_transparent',
'ie_key': 'ThePlatform',
'url': smuggle_url(update_url_query(release_url, {'mbr': 'true', 'switch': 'http'}),
{'force_smil_url': True}),
'url': smuggle_url(update_url_query(release_url, {'mbr': True, 'switch': 'http'}), {'force_smil_url': True}),
'id': video_id,
Copy link
Contributor Author

@TRox1972 TRox1972 Jun 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I return the video_id as the id, or leave it up to ThePlatform; the result is different.

'display_id': display_id,
}