本人在找fetch的同步请求,发现大部分博客都是营销狗的牛头不对马嘴一直在水的贴,只有极少部分可以参考(讲的不是很详细);本人参考的博客: https://www.cnblogs.com/liquanjiang/p/11409792.html
//顺便把这种302的视频流切片重定向的给转出来
var hls=['https://jx.bigmao.top:81/jump/caalArWJIdvL3srp-rj6AZlB8s-IyYwP0r3U9kBLya1Z-NGxrqTdAvDDimaVgfyr%3DKVZpr%3DTFJh2tazfJaSnsaSxN.ts',
'https://jx.bigmao.top:81/jump/RQIH8dMOxBzz%3DacfmSni2dcDgOzvrcn%3DuT43xZ3-qCk6%3DNobWI03nT5rOJXDaa6fOMjrcY4GtCUa4N4OsEEO3NF22.ts',
'https://jx.bigmao.top:81/jump/RQIH8dMOxBzz%3DacfmSni2dcDgOzvrcn%3DuT43xZ3-tEUa-OofWJnD4N8jCUXvcRcn5MU27Y4GtCUa4N4OsEEO3NF22.ts'
];
fetchposts(hls,function(e){
console.log(e);
});
async function fetchposts(arr,call){
var str='';
for(var i=0;i<arr.length;i++){
await promises(arr[i]).then(function(e){
str+=e+ '\n';
return e;
});
}
call(str);
}
function promises(fname) {
return new Promise((resolve, reject)=> {
try{
fetch(fname,{method: "POST",redirect:'follow'})
.then(function(e){
resolve(e.url);
})
} catch(e){
console.log(e);
}
})
}