mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-01 14:44:28 +02:00
merge: api 10.7.7 from main
This commit is contained in:
commit
187bf9d745
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@imput/cobalt-api",
|
"name": "@imput/cobalt-api",
|
||||||
"description": "save what you love",
|
"description": "save what you love",
|
||||||
"version": "10.7.6",
|
"version": "10.7.7",
|
||||||
"author": "imput",
|
"author": "imput",
|
||||||
"exports": "./src/cobalt.js",
|
"exports": "./src/cobalt.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -53,14 +53,25 @@ async function handleYoutubeStream(streamInfo, res) {
|
|||||||
const cleanup = () => (res.end(), closeRequest(streamInfo.controller));
|
const cleanup = () => (res.end(), closeRequest(streamInfo.controller));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const req = await fetch(streamInfo.url, {
|
let req, attempts = 3;
|
||||||
headers: getHeaders('youtube'),
|
while (attempts--) {
|
||||||
method: 'HEAD',
|
req = await fetch(streamInfo.url, {
|
||||||
dispatcher: streamInfo.dispatcher,
|
headers: getHeaders('youtube'),
|
||||||
signal
|
method: 'HEAD',
|
||||||
});
|
dispatcher: streamInfo.dispatcher,
|
||||||
|
signal
|
||||||
|
});
|
||||||
|
|
||||||
|
streamInfo.url = req.url;
|
||||||
|
if (req.status === 403 && streamInfo.transplant) {
|
||||||
|
try {
|
||||||
|
await streamInfo.transplant(streamInfo.dispatcher);
|
||||||
|
} catch {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else break;
|
||||||
|
}
|
||||||
|
|
||||||
streamInfo.url = req.url;
|
|
||||||
const size = BigInt(req.headers.get('content-length'));
|
const size = BigInt(req.headers.get('content-length'));
|
||||||
|
|
||||||
if (req.status !== 200 || !size) {
|
if (req.status !== 200 || !size) {
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shared video link",
|
"name": "shared video link",
|
||||||
"url": "https://www.facebook.com/share/v/NEf87jbPTvFE8LsL/",
|
"url": "https://www.facebook.com/share/v/6EJK4Z8EAEAHtz8K/",
|
||||||
"params": {},
|
"params": {},
|
||||||
"expected": {
|
"expected": {
|
||||||
"code": 200,
|
"code": 200,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user