merge: updates from main

This commit is contained in:
wukko 2025-02-24 15:11:30 +06:00
commit 540aee6194
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
8 changed files with 23 additions and 21 deletions

View file

@ -33,4 +33,4 @@ jobs:
- run: pnpm i --frozen-lockfile && node api/src/util/test run-tests-for ${{ matrix.service }}
env:
API_EXTERNAL_PROXY: ${{ secrets.API_EXTERNAL_PROXY }}
TEST_IGNORE_SERVICES: "none"
TEST_IGNORE_SERVICES: ${{ vars.TEST_IGNORE_SERVICES }}

View file

@ -1,7 +1,7 @@
{
"name": "@imput/cobalt-api",
"description": "save what you love",
"version": "10.7.4",
"version": "10.7.6",
"author": "imput",
"exports": "./src/cobalt.js",
"type": "module",
@ -39,7 +39,7 @@
"set-cookie-parser": "2.6.0",
"undici": "^5.19.1",
"url-pattern": "1.0.3",
"youtubei.js": "^13.0.0",
"youtubei.js": "^13.1.0",
"zod": "^3.23.8"
},
"optionalDependencies": {

View file

@ -227,7 +227,8 @@ export default async function({ host, patternMatch, params }) {
case "facebook":
r = await facebook({
...patternMatch
...patternMatch,
dispatcher
});
break;

View file

@ -8,8 +8,8 @@ const headers = {
'Sec-Fetch-Site': 'none',
}
const resolveUrl = (url) => {
return fetch(url, { headers })
const resolveUrl = (url, dispatcher) => {
return fetch(url, { headers, dispatcher })
.then(r => {
if (r.headers.get('location')) {
return decodeURIComponent(r.headers.get('location'));
@ -23,13 +23,13 @@ const resolveUrl = (url) => {
.catch(() => false);
}
export default async function({ id, shareType, shortLink }) {
export default async function({ id, shareType, shortLink, dispatcher }) {
let url = `https://web.facebook.com/i/videos/${id}`;
if (shareType) url = `https://web.facebook.com/share/${shareType}/${id}`;
if (shortLink) url = await resolveUrl(`https://fb.watch/${shortLink}`);
if (shortLink) url = await resolveUrl(`https://fb.watch/${shortLink}`, dispatcher);
const html = await fetch(url, { headers })
const html = await fetch(url, { headers, dispatcher })
.then(r => r.text())
.catch(() => false);

View file

@ -15,7 +15,7 @@ const getTests = (service) => loadJSON(getTestPath(service));
// services that are known to frequently fail due to external
// factors (e.g. rate limiting)
const finnicky = new Set(
typeof process.env.TEST_IGNORE_SERVICES === 'string'
process.env.TEST_IGNORE_SERVICES
? process.env.TEST_IGNORE_SERVICES.split(',')
: ['bilibili', 'instagram', 'facebook', 'youtube', 'vk', 'twitter', 'reddit']
);

View file

@ -56,8 +56,8 @@ importers:
specifier: 1.0.3
version: 1.0.3
youtubei.js:
specifier: ^13.0.0
version: 13.0.0
specifier: ^13.1.0
version: 13.1.0
zod:
specifier: ^3.23.8
version: 3.23.8
@ -1468,8 +1468,8 @@ packages:
resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==}
engines: {node: 20 || >=22}
jintr@3.2.0:
resolution: {integrity: sha512-psD1yf05kMKDNsUdW1l5YhO59pHScQ6OIHHb8W5SKSM2dCOFPsqolmIuSHgVA8+3Dc47NJR181CXZ4alCAPTkA==}
jintr@3.2.1:
resolution: {integrity: sha512-yjKUBuwTTg4nc4izMysxuIk0BKh45hnbc1KnXE6LxagIGZn5od+I2elpuRY9IIm3EiKiUZxhxV89a0iX+xoEZg==}
joycon@3.1.1:
resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
@ -2286,8 +2286,8 @@ packages:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'}
youtubei.js@13.0.0:
resolution: {integrity: sha512-b1QkN9bfgphK+5tI4qteSK54kNxmPhoedvMw0jl4uSn+L8gbDbJ4z52amNuYNcOdp4X/SI3JuUb+f5V0DPJ8Vw==}
youtubei.js@13.1.0:
resolution: {integrity: sha512-uL4TyojAYET0c5NGFD7+ScCod/k8Pc/B+D5tLrunFcz1GaBjRMOGRPcNGaRmnhwisegU7ibtw0iUxCN+BZ0ang==}
zod@3.23.8:
resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==}
@ -3519,7 +3519,7 @@ snapshots:
dependencies:
'@isaacs/cliui': 8.0.2
jintr@3.2.0:
jintr@3.2.1:
dependencies:
acorn: 8.14.0
@ -4242,10 +4242,10 @@ snapshots:
yocto-queue@0.1.0: {}
youtubei.js@13.0.0:
youtubei.js@13.1.0:
dependencies:
'@bufbuild/protobuf': 2.1.0
jintr: 3.2.0
jintr: 3.2.1
tslib: 2.6.3
undici: 5.28.4

View file

@ -30,7 +30,8 @@
"api.capacity": "cobalt is at capacity and can't process your request at the moment. try again in a few seconds!",
"api.generic": "something went wrong and i couldn't get anything for you, try again in a few seconds. if the issue sticks, please report it!",
"api.unknown_response": "couldn't read the response from the processing instance. this could be caused by a version mismatch between cobalt instances.",
"api.unknown_response": "couldn't read the response from the processing instance. this is probably caused by the web app being out of date. reload the app and try again!",
"api.invalid_body": "couldn't send the request to the processing instance. this is probably caused by the web app being out of date. reload the app and try again!",
"api.service.unsupported": "this service is not supported yet. have you pasted the right link?",
"api.service.disabled": "this service is generally supported by cobalt, but it's disabled on this processing instance. try a link from another service!",

View file

@ -1,6 +1,6 @@
{
"name": "@imput/cobalt-web",
"version": "10.7.3",
"version": "10.7.5",
"type": "module",
"private": true,
"scripts": {