mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 00:31:26 +01:00
Compare commits
3 Commits
061a17f18b
...
0910849587
Author | SHA1 | Date | |
---|---|---|---|
|
0910849587 | ||
|
295e8e45aa | ||
|
5b762e5c4e |
|
@ -1,5 +1,4 @@
|
|||
import json
|
||||
import random
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
|
@ -7,7 +6,6 @@ from ..utils import (
|
|||
try_call,
|
||||
unified_timestamp,
|
||||
urlencode_postdata,
|
||||
xpath_text,
|
||||
)
|
||||
|
||||
|
||||
|
@ -15,10 +13,8 @@ class EplusIbIE(InfoExtractor):
|
|||
_NETRC_MACHINE = 'eplus'
|
||||
IE_NAME = 'eplus'
|
||||
IE_DESC = 'e+ (イープラス)'
|
||||
_VALID_URL = [
|
||||
r'https?://live\.eplus\.jp/ex/player\?ib=(?P<id>(?:\w|%2B|%2F){86}%3D%3D)',
|
||||
r'https?://live\.eplus\.jp/(?P<id>sample|\d+)',
|
||||
]
|
||||
_VALID_URL = [r'https?://live\.eplus\.jp/ex/player\?ib=(?P<id>(?:\w|%2B|%2F){86}%3D%3D)',
|
||||
r'https?://live\.eplus\.jp/(?P<id>sample|\d+)']
|
||||
_TESTS = [{
|
||||
'url': 'https://live.eplus.jp/ex/player?ib=YEFxb3Vyc2Dombnjg7blkrLlrablnJLjgrnjgq%2Fjg7zjg6vjgqLjgqTjg4njg6vlkIzlpb3kvJpgTGllbGxhIQ%3D%3D',
|
||||
'info_dict': {
|
||||
|
@ -79,34 +75,33 @@ class EplusIbIE(InfoExtractor):
|
|||
}]
|
||||
|
||||
_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0'
|
||||
_TEST_EVENT_URL = 'https://live.eplus.jp/2053935'
|
||||
|
||||
def _perform_login(self, id, password):
|
||||
fake_event_url = f'https://live.eplus.jp/{random.randrange(2000000, 10000000)}'
|
||||
webpage, urlh = self._download_webpage_handle(
|
||||
fake_event_url, None, note='Getting auth status', errnote='Unable to get auth status')
|
||||
if urlh.url.startswith(fake_event_url):
|
||||
self._TEST_EVENT_URL, None, note='Getting auth status', errnote='Unable to get auth status')
|
||||
if urlh.url.startswith(self._TEST_EVENT_URL):
|
||||
# already logged in
|
||||
return
|
||||
|
||||
cltft_token = self._hidden_inputs(webpage).get('Token.Default')
|
||||
if not cltft_token:
|
||||
self.report_warning('Unable to get X-CLTFT-Token')
|
||||
return
|
||||
raise ExtractorError('Unable to get X-CLTFT-Token', expected=False)
|
||||
self._set_cookie('live.eplus.jp', 'X-CLTFT-Token', f'Token.Default={cltft_token}')
|
||||
|
||||
login_xml = self._download_xml(
|
||||
login_json = self._download_json(
|
||||
'https://live.eplus.jp/member/api/v1/FTAuth/idpw', None,
|
||||
note='Sending pre-login info', errnote='Unable to send pre-login info', headers={
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Referer': urlh.url,
|
||||
'X-Cltft-Token': f'Token.Default={cltft_token}',
|
||||
'Accept': '*/*',
|
||||
}, data=json.dumps({
|
||||
'loginId': id,
|
||||
'loginPassword': password,
|
||||
}).encode('utf-8'))
|
||||
flag = xpath_text(login_xml, './isSuccess', default=None)
|
||||
if flag != 'true':
|
||||
raise
|
||||
}).encode())
|
||||
if not login_json.get('isSuccess'):
|
||||
raise ExtractorError('Login failed: Invalid id or password', expected=True)
|
||||
|
||||
self._request_webpage(
|
||||
urlh.url, None, note='Logging in', errnote='Unable to log in',
|
||||
|
@ -122,7 +117,8 @@ class EplusIbIE(InfoExtractor):
|
|||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage, urlh = self._download_webpage_handle(url, video_id)
|
||||
webpage, urlh = self._download_webpage_handle(
|
||||
url, video_id, headers={'User-Agent': self._USER_AGENT})
|
||||
if urlh.url.startswith('https://live.eplus.jp/member/auth'):
|
||||
self.raise_login_required()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user