Open sabuaka18 opened 2 years ago
not [video/videoID] but [video/videoRefID]
TVer(20220401ver) URL convert sttep.
Step1 - Get TVerID https://tver.jp/episodes/(tverid)
Step2 - Get accountID and videoRefID https://statics.tver.jp/content/episode/(tverid).json?v=5 or https://statics.tver.jp/content/episode/(tverid).json?v=8 get[video/accountID] get[video/videoID] -> goto Step 4 get[video/videoRefID] -> goto Step 3
Step3 - Get videoId(Step2: [video/videoRefID] only) https://edge.api.brightcove.com/playback/v1/accounts/[video/accountID]/videos/ref%3A[video/videoRefID] get[video/videoID]
Step4 - Get Video URL http://players.brightcove.net/[video/accountID]/default_default/index.html?videoId=[video/videoID]
Brightcove is returning 404 from the UK with the videoID
for https://tver.jp/episodes/ep6f16g26p where there's no videoRefID
in the video
object of the JSON.
Brightcove is returning 404 from the UK with the
videoID
for https://tver.jp/episodes/ep6f16g26p where there's novideoRefID
in thevideo
object of the JSON.
ex) https://tver.jp/episodes/ep6f16g26p Step1 get[ https://statics.tver.jp/content/episode/ep6f16g26p.json?v=7 ] Step2 json check [video/accountid] => 3971130137001 [video/videoid] => 6302378806001 [video/videorefid] => (undefined) Step3 Skip.(videoid ok) Step4 get[ http://players.brightcove.net/3971130137001/default_default/index.html?videoId=6302378806001 ]
Connection from Japan
(tverid) -> Video URL Converter.
PHP Code
<?php $response = ''; $r = 0; $conn = curl_init(); curl_setopt($conn, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($conn, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($conn, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36'); curl_setopt($conn, CURLOPT_URL, 'https://statics.tver.jp/content/episode/'.$episodes.'.json?v=7'); curl_setopt($conn, CURLOPT_HTTPHEADER, [ 'origin: https://tver.jp', 'referer: https://tver.jp/', 'sec-fetch-mode: cors' ]); $response = curl_exec($conn); $info = curl_getinfo($conn); if(isset($info['http_code']) && $info['http_code'] == 200){ $r = 1; } curl_close($conn); if($r){ $tver['accountid'] = ''; $tver['videoid'] = ''; $tver['videorefid'] = ''; $json = json_decode($response, 1); if(isset($json['video']['accountID']) && $json['video']['accountID']){ $tver['accountid'] = $json['video']['accountID']; } if(isset($json['video']['videoID']) && $json['video']['videoID']){ $tver['videoid'] = $json['video']['videoID']; } if(isset($json['video']['videoRefID']) && $json['video']['videoRefID']){ $tver['videorefid'] = $json['video']['videoRefID']; } if($tver['videoid'] == '' && $tver['videorefid'] != ''){ $tver['videoid'] = videorefid2videoid($tver['accountid'], $tver['videorefid']); } if($tver['videoid'] == ''){ /*Error*/ }else{ printf('http://players.brightcove.net/%s/default_default/index.html?videoId=%s', $tver['accountid'], $tver['videoid']); } }else{ /*Error*/ } function videorefid2videoid($accountid, $videorefid){ $videoid = ''; $response = ''; $r = 0; $conn = curl_init(); curl_setopt($conn, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($conn, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($conn, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36'); curl_setopt($conn, CURLOPT_URL, 'https://edge.api.brightcove.com/playback/v1/accounts/'.$accountid.'/videos/ref%3A'.$videorefid); curl_setopt($conn, CURLOPT_HTTPHEADER, [ 'accept: application/json;pk=BCpkA.................................' ]); $response = curl_exec($conn); $info = curl_getinfo($conn); if(isset($info['http_code']) && $info['http_code'] == 200){ $r = 1; } curl_close($conn); if($r){ $json = json_decode($response, 1); if(isset($json['id']) && $json['id'] != ''){ $videoid = $json['id']; } } return($videoid); } ?>
As I submitted at https://github.com/yt-dlp/yt-dlp/pull/3268 , BrightcoveNewIE can handle both videoID and videoRefID, when parameters are appropriately passed.
TVer(20220401ver) URL convert sttep.
Step1 - Get TVerID https://tver.jp/episodes/(tverid)
Step2 - Get accountID and videoRefID https://statics.tver.jp/content/episode/(tverid).json?v=5 or https://statics.tver.jp/content/episode/(tverid).json?v=8 get[video/accountID] get[video/videoID] -> goto Step 4 get[video/videoRefID] -> goto Step 3
Step3 - Get videoId(Step2: [video/videoRefID] only) https://edge.api.brightcove.com/playback/v1/accounts/[video/accountID]/videos/ref%3A[video/videoRefID] get[video/videoID]
Step4 - Get Video URL http://players.brightcove.net/[video/accountID]/default_default/index.html?videoId=[video/videoID]
Brightcove is returning 404 for https://tver.jp/episodes/ep5y3111ol where there's only videoRefID in the video object of the JSON. ex) https://tver.jp/episodes/ep5y3111ol Step1 get[ https://statics.tver.jp/content/episode/ep5y3111ol.json?v=7 ] Step2 json check [video/accountid] => 4031511847001 [video/videoid] => (undefined) [video/videorefid] => 20144_2000609_1000017963 Step3 - Get videoId(Step2: [video/videoRefID] only) https://edge.api.brightcove.com/playback/v1/accounts/4031511847001/videos/ref%3A20144_2000609_1000017963
returning "error_code": "INVALID_POLICY_KEY", "message": "Request policy key is missing or invalid"
It seems VideoID is provided for a few contents - news, sports, etc. Then, Step4 works well. But in the case of VideoRefID , Step3 is not working and occurs the error.
error_code "INVALID_POLICY_KEY" message "Request policy key is missing or invalid"
A PR based on yt-dlp #3268 will appear shortly.
The solution you sugested works well now. Thanx for your information.
The solution you sugested works well now. Thanx for your information.
Did you find the solution of "videoRefID" problem??
dirkf uploaded fixed extractor for Tver. https://github.com/dirkf/youtube-dl/blob/7c254e260f348fe236c54580bf416a40f8fe0063/youtube_dl/extractor/tver.py
To put in a nut shell, in the case of VideorefID provided, then VideoID = 'ref:'+(VideorefID) For your example, [video/videorefid] => 20144_2000609_1000017963 then, VideoID = ref:20144_2000609_1000017963 and apply the VideoID to Step4,
Please load and test this PR if you can, and report in the PR thread.
guys, it's can update for the windows version?
Checklist
Verbose log
Description
Tver.jp has had a major overhaul of the website the old https://tver.jp/api/access_token.php no longer works. It uses somthing like https://platform-api.tver.jp/v2/api/platform_users/info?platform_uid=xxxxxxxxxxxxxxxx&platform_token=xxxxxxxxxxxxxxxx now the old https://tver.jp/corner/xxxxx or https://tver.jp/feature/xxxxxx now redirects to https://tver.jp/episodes/xxxxxxx for example: https://tver.jp/corner/f0103888 now redirects to https://tver.jp/episodes/ep6f16g26p this seems like to be the example of m3u8 url for the url above https://manifest.prod.boltdns.net/manifest/v1/hls/v4/aes128/3971130137001/xxxxx-xxxx-xxxx-xxxx-xxxxxxx/10s/master.m3u8?behavior_id=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx&fastly_token=xxxxxxxxxxxxxxxxxxxxxxxx
see also https://github.com/yt-dlp/yt-dlp/issues/3261