mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 00:31:26 +01:00
Compare commits
No commits in common. "061a17f18b293832fe2b4b33372d437b17ecabc6" and "66dca1f8e9e4b57e25d7620a778c3b80e9adf447" have entirely different histories.
061a17f18b
...
66dca1f8e9
|
@ -1,23 +1,17 @@
|
|||
import json
|
||||
import random
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
try_call,
|
||||
unified_timestamp,
|
||||
urlencode_postdata,
|
||||
xpath_text,
|
||||
)
|
||||
|
||||
|
||||
class EplusIbIE(InfoExtractor):
|
||||
_NETRC_MACHINE = 'eplus'
|
||||
IE_NAME = 'eplus'
|
||||
IE_DESC = 'e+ (イープラス)'
|
||||
IE_NAME = 'eplus:inbound'
|
||||
IE_DESC = 'e+ (イープラス) overseas'
|
||||
_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+)',
|
||||
r'https?://live\.eplus\.jp/(?P<id>sample)',
|
||||
]
|
||||
_TESTS = [{
|
||||
'url': 'https://live.eplus.jp/ex/player?ib=YEFxb3Vyc2Dombnjg7blkrLlrablnJLjgrnjgq%2Fjg7zjg6vjgqLjgqTjg4njg6vlkIzlpb3kvJpgTGllbGxhIQ%3D%3D',
|
||||
|
@ -58,73 +52,13 @@ class EplusIbIE(InfoExtractor):
|
|||
'Requested format is not available',
|
||||
'This video is DRM protected',
|
||||
],
|
||||
}, {
|
||||
'url': 'https://live.eplus.jp/2053935',
|
||||
'info_dict': {
|
||||
'id': '331320-0001-001',
|
||||
'title': '丘みどり2020配信LIVE Vol.2 ~秋麗~ 【Streaming+(配信チケット)】',
|
||||
'live_status': 'was_live',
|
||||
'release_date': '20200920',
|
||||
'release_timestamp': 1600596000,
|
||||
},
|
||||
'params': {
|
||||
'skip_download': True,
|
||||
'ignore_no_formats_error': True,
|
||||
},
|
||||
'expected_warnings': [
|
||||
'Could not find the playlist URL. This event may not be accessible',
|
||||
'No video formats found!',
|
||||
'Requested format is not available',
|
||||
],
|
||||
}]
|
||||
|
||||
_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'
|
||||
|
||||
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):
|
||||
# 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
|
||||
self._set_cookie('live.eplus.jp', 'X-CLTFT-Token', f'Token.Default={cltft_token}')
|
||||
|
||||
login_xml = self._download_xml(
|
||||
'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}',
|
||||
}, data=json.dumps({
|
||||
'loginId': id,
|
||||
'loginPassword': password,
|
||||
}).encode('utf-8'))
|
||||
flag = xpath_text(login_xml, './isSuccess', default=None)
|
||||
if flag != 'true':
|
||||
raise
|
||||
|
||||
self._request_webpage(
|
||||
urlh.url, None, note='Logging in', errnote='Unable to log in',
|
||||
data=urlencode_postdata({
|
||||
'loginId': id,
|
||||
'loginPassword': password,
|
||||
'Token.Default': cltft_token,
|
||||
'op': 'nextPage',
|
||||
}), headers={
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Referer': urlh.url,
|
||||
})
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage, urlh = self._download_webpage_handle(url, video_id)
|
||||
if urlh.url.startswith('https://live.eplus.jp/member/auth'):
|
||||
self.raise_login_required()
|
||||
webpage = self._download_webpage(url, video_id, headers={'User-Agent': self._USER_AGENT})
|
||||
|
||||
data_json = self._search_json(r'<script>\s*var app\s*=', webpage, 'data json', video_id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user