0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-30 03:33:02 +00:00

[ellentv] Clean up and simplify

This commit is contained in:
Sergey M․ 2015-01-03 21:44:47 +06:00
parent 7d02fae85b
commit f4f339529c

View file

@ -1,7 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
import json import json
from .common import InfoExtractor from .common import InfoExtractor
@ -12,7 +11,7 @@
class EllenTVIE(InfoExtractor): class EllenTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)' _VALID_URL = r'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)'
_TESTS = [{ _TESTS = [{
'url': 'http://www.ellentv.com/videos/0-7jqrsr18/', 'url': 'http://www.ellentv.com/videos/0-7jqrsr18/',
'md5': 'e4af06f3bf0d5f471921a18db5764642', 'md5': 'e4af06f3bf0d5f471921a18db5764642',
@ -23,8 +22,7 @@ class EllenTVIE(InfoExtractor):
'timestamp': 1406876400, 'timestamp': 1406876400,
'upload_date': '20140801', 'upload_date': '20140801',
} }
}, }, {
{
'url': 'http://ellentube.com/videos/0-dvzmabd5/', 'url': 'http://ellentube.com/videos/0-dvzmabd5/',
'md5': '98238118eaa2bbdf6ad7f708e3e4f4eb', 'md5': '98238118eaa2bbdf6ad7f708e3e4f4eb',
'info_dict': { 'info_dict': {
@ -37,16 +35,12 @@ class EllenTVIE(InfoExtractor):
}] }]
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) video_id = self._match_id(url)
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
timestamp = parse_iso8601(self._search_regex( timestamp = parse_iso8601(self._search_regex(
r'<span class="publish-date"><time datetime="([^"]+)">', r'<span class="publish-date"><time datetime="([^"]+)">',
webpage, 'timestamp')) webpage, 'timestamp'))
print "\n"
print timestamp
print "\n"
return { return {
'id': video_id, 'id': video_id,
@ -69,8 +63,7 @@ class EllenTVClipsIE(InfoExtractor):
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) playlist_id = self._match_id(url)
playlist_id = mobj.group('id')
webpage = self._download_webpage(url, playlist_id) webpage = self._download_webpage(url, playlist_id)
playlist = self._extract_playlist(webpage) playlist = self._extract_playlist(webpage)