mirror of https://github.com/blackjack4494/yt-dlc
[einthusan] Improve extraction (Closes #7877)
This commit is contained in:
parent
8f7c4f7d2e
commit
b26afec81f
|
@ -1,9 +1,12 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_urlparse
|
||||||
|
from ..utils import (
|
||||||
|
remove_start,
|
||||||
|
sanitized_Request,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class EinthusanIE(InfoExtractor):
|
class EinthusanIE(InfoExtractor):
|
||||||
|
@ -34,30 +37,33 @@ class EinthusanIE(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)
|
|
||||||
|
|
||||||
video_title = self._html_search_regex(
|
request = sanitized_Request(url)
|
||||||
r'<h1><a class="movie-title".*?>(.*?)</a></h1>', webpage, 'title')
|
request.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 5.2; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0')
|
||||||
|
webpage = self._download_webpage(request, video_id)
|
||||||
|
|
||||||
movieid = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'data-movieid="(.*?)"', webpage, 'movieid')
|
r'<h1><a[^>]+class=["\']movie-title["\'][^>]*>(.+?)</a></h1>',
|
||||||
|
webpage, 'title')
|
||||||
|
|
||||||
location = 'Washington'
|
video_id = self._search_regex(
|
||||||
geturl = 'http://cdn.einthusan.com/geturl/%s/hd/%s' % (movieid, location)
|
r'data-movieid=["\'](\d+)', webpage, 'video id', default=video_id)
|
||||||
video_url = self._download_webpage(geturl, video_id)
|
|
||||||
|
video_url = self._download_webpage(
|
||||||
|
'http://cdn.einthusan.com/geturl/%s/hd/London,Washington,Toronto,Dallas,San,Sydney/'
|
||||||
|
% video_id, video_id)
|
||||||
|
|
||||||
description = self._html_search_meta('description', webpage)
|
description = self._html_search_meta('description', webpage)
|
||||||
thumbnail = self._html_search_regex(
|
thumbnail = self._html_search_regex(
|
||||||
r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''',
|
r'''<a class="movie-cover-wrapper".*?><img src=["'](.*?)["'].*?/></a>''',
|
||||||
webpage, "thumbnail url", fatal=False)
|
webpage, "thumbnail url", fatal=False)
|
||||||
if thumbnail is not None:
|
if thumbnail is not None:
|
||||||
thumbnail = thumbnail.replace('..', 'http://www.einthusan.com')
|
thumbnail = compat_urlparse.urljoin(url, remove_start(thumbnail, '..'))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video_title,
|
'title': title,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'description': description,
|
'description': description,
|
||||||
|
|
Loading…
Reference in New Issue