本帖最后由 huanxiong 于 2022-4-10 17:38 编辑
求大佬指点
刚学习PHP,拿某讯课堂练手
已经可以获取到课程名称和视频m3u8的地址,整理成类似这样
[JavaScript] 纯文本查看 复制代码 [
{
"title":"截面法",
"url":[
"https://1258712167.vod2.myqcloud.com/5a81e359vodtranssh1258712167/e6800d125285890813737225495/drm/voddrm.token.dWluPTIyMzUxMTMxOTY7c2tleT07cHNrZXk9O3Bsc2tleT0wMDA0MDAwMDYyOGQ0ZjI0ZDhkNTZjYTZlM2Y2NGIwMDgxZjE4MGM1YTViODcxNmNiMTdmNjA5ZjNmMzRlMTlhMmEyZTE2ZjY5ZGFiMTFhYmU5MWRjODBlO2V4dD07dWlkX3R5cGU9MDt1aWRfb3JpZ2luX3VpZF90eXBlPTA7dWlkX29yaWdpbl9hdXRoX3R5cGU9MDtjaWQ9NDQyNTgxO3Rlcm1faWQ9MTAyMTMwMjYyO3ZvZF90eXBlPTA=.v.f30742.m3u8?t=625D29C4&exper=0&us=2029940670762813336&sign=fba547a53891c5855635df83805a9470",
"https://1258712167.vod2.myqcloud.com/5a81e359vodtranssh1258712167/e6800d125285890813737225495/drm/voddrm.token.dWluPTIyMzUxMTMxOTY7c2tleT07cHNrZXk9O3Bsc2tleT0wMDA0MDAwMDYyOGQ0ZjI0ZDhkNTZjYTZlM2Y2NGIwMDgxZjE4MGM1YTViODcxNmNiMTdmNjA5ZjNmMzRlMTlhMmEyZTE2ZjY5ZGFiMTFhYmU5MWRjODBlO2V4dD07dWlkX3R5cGU9MDt1aWRfb3JpZ2luX3VpZF90eXBlPTA7dWlkX29yaWdpbl9hdXRoX3R5cGU9MDtjaWQ9NDQyNTgxO3Rlcm1faWQ9MTAyMTMwMjYyO3ZvZF90eXBlPTA=.v.f30741.m3u8?t=625D29C4&exper=0&us=7127235518283542733&sign=b6736c6bb3c4075ffea406a2f302adea",
"https://1258712167.vod2.myqcloud.com/5a81e359vodtranssh1258712167/e6800d125285890813737225495/drm/voddrm.token.dWluPTIyMzUxMTMxOTY7c2tleT07cHNrZXk9O3Bsc2tleT0wMDA0MDAwMDYyOGQ0ZjI0ZDhkNTZjYTZlM2Y2NGIwMDgxZjE4MGM1YTViODcxNmNiMTdmNjA5ZjNmMzRlMTlhMmEyZTE2ZjY5ZGFiMTFhYmU5MWRjODBlO2V4dD07dWlkX3R5cGU9MDt1aWRfb3JpZ2luX3VpZF90eXBlPTA7dWlkX29yaWdpbl9hdXRoX3R5cGU9MDtjaWQ9NDQyNTgxO3Rlcm1faWQ9MTAyMTMwMjYyO3ZvZF90eXBlPTA=.v.f30740.m3u8?t=625D29C4&exper=0&us=4698840354260634299&sign=87dbbb556b381ba5c70b5444195223f3"
]
},
{
"title":"拉压变形",
"url":[
"https://1258712167.vod2.myqcloud.com/5a81e359vodtranssh1258712167/e65d958c5285890813737208920/drm/voddrm.token.dWluPTIyMzUxMTMxOTY7c2tleT07cHNrZXk9O3Bsc2tleT0wMDA0MDAwMDYyOGQ0ZjI0ZDhkNTZjYTZlM2Y2NGIwMDgxZjE4MGM1YTViODcxNmNiMTdmNjA5ZjNmMzRlMTlhMmEyZTE2ZjY5ZGFiMTFhYmU5MWRjODBlO2V4dD07dWlkX3R5cGU9MDt1aWRfb3JpZ2luX3VpZF90eXBlPTA7dWlkX29yaWdpbl9hdXRoX3R5cGU9MDtjaWQ9NDQyNTgxO3Rlcm1faWQ9MTAyMTMwMjYyO3ZvZF90eXBlPTA=.v.f30742.m3u8?t=625D29C4&exper=0&us=5867580516719428455&sign=8361f81c321cd11bdedebff4b90a5f13",
"https://1258712167.vod2.myqcloud.com/5a81e359vodtranssh1258712167/e65d958c5285890813737208920/drm/voddrm.token.dWluPTIyMzUxMTMxOTY7c2tleT07cHNrZXk9O3Bsc2tleT0wMDA0MDAwMDYyOGQ0ZjI0ZDhkNTZjYTZlM2Y2NGIwMDgxZjE4MGM1YTViODcxNmNiMTdmNjA5ZjNmMzRlMTlhMmEyZTE2ZjY5ZGFiMTFhYmU5MWRjODBlO2V4dD07dWlkX3R5cGU9MDt1aWRfb3JpZ2luX3VpZF90eXBlPTA7dWlkX29yaWdpbl9hdXRoX3R5cGU9MDtjaWQ9NDQyNTgxO3Rlcm1faWQ9MTAyMTMwMjYyO3ZvZF90eXBlPTA=.v.f30741.m3u8?t=625D29C4&exper=0&us=4608941062324352942&sign=16c93a8fa992475133ae0e06499560e6",
"https://1258712167.vod2.myqcloud.com/5a81e359vodtranssh1258712167/e65d958c5285890813737208920/drm/voddrm.token.dWluPTIyMzUxMTMxOTY7c2tleT07cHNrZXk9O3Bsc2tleT0wMDA0MDAwMDYyOGQ0ZjI0ZDhkNTZjYTZlM2Y2NGIwMDgxZjE4MGM1YTViODcxNmNiMTdmNjA5ZjNmMzRlMTlhMmEyZTE2ZjY5ZGFiMTFhYmU5MWRjODBlO2V4dD07dWlkX3R5cGU9MDt1aWRfb3JpZ2luX3VpZF90eXBlPTA7dWlkX29yaWdpbl9hdXRoX3R5cGU9MDtjaWQ9NDQyNTgxO3Rlcm1faWQ9MTAyMTMwMjYyO3ZvZF90eXBlPTA=.v.f30740.m3u8?t=625D29C4&exper=0&us=1532996741176086724&sign=17e873523b9ca9926ab7192379a49b61"
]
}
]
但是在调用逍遥一仙大佬的m3u8下载器的时候,出现了部分课程下载提示m3u8无效,或者是文件名称中部分字符变成“?”的问题
文件名称有问号应该是编码的问题。而m3u8失效问题看下载器保存的失败详情,m3u8地址多出来这么一些奇怪的字符,感觉也是编码的问题
代码里面已经把字符编码从utf8转换成了下载器要的gbk
[PHP] 纯文本查看 复制代码 for ($i=0;$i<count($result);$i++) {
$j = $i + 1;
$data = $j.'.'.$result[$i]['title'].','.$result[$i]['url'][$definition];
$data = iconv("UTF-8","gbk//TRANSLIT",$data);
$data = base64_encode($data);
$data = iconv("UTF-8","gbk//TRANSLIT",'data='.$data.',type=2');
if (json_decode(postSubmit('127.0.0.1:8787',$data,[]),true)['stat'] == true) {
$number++;
}
}
求助大佬们看看这是我代码里面编码转换的问题还是哪里出错了,或者说怎么能解决这个问题
在此拜谢了! |