diff --git a/.github/workflows/test-services.yml b/.github/workflows/test-services.yml index 993fbcb4..ad6e25b7 100644 --- a/.github/workflows/test-services.yml +++ b/.github/workflows/test-services.yml @@ -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 }} diff --git a/api/package.json b/api/package.json index 72e573b5..0c446d3c 100644 --- a/api/package.json +++ b/api/package.json @@ -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": { diff --git a/api/src/processing/match.js b/api/src/processing/match.js index 56b72bd2..8d3ba70f 100644 --- a/api/src/processing/match.js +++ b/api/src/processing/match.js @@ -227,7 +227,8 @@ export default async function({ host, patternMatch, params }) { case "facebook": r = await facebook({ - ...patternMatch + ...patternMatch, + dispatcher }); break; diff --git a/api/src/processing/services/facebook.js b/api/src/processing/services/facebook.js index 7bfd4751..9e9d060d 100644 --- a/api/src/processing/services/facebook.js +++ b/api/src/processing/services/facebook.js @@ -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); diff --git a/api/src/util/test.js b/api/src/util/test.js index a11130a7..abb9b3cd 100644 --- a/api/src/util/test.js +++ b/api/src/util/test.js @@ -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'] ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15707176..a55ff959 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/web/i18n/en/error.json b/web/i18n/en/error.json index 0ba5cc86..eed9eec5 100644 --- a/web/i18n/en/error.json +++ b/web/i18n/en/error.json @@ -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!", diff --git a/web/package.json b/web/package.json index 954eb5d7..827b6f7b 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "@imput/cobalt-web", - "version": "10.7.3", + "version": "10.7.5", "type": "module", "private": true, "scripts": {