Skip to content

Commit

Permalink
More explicit error logging around onesie
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Dec 9, 2024
1 parent ea5c2e4 commit 85ad257
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
"fastify-healthcheck": "^5.0.0",
"fastify-metrics": "^12.1.0",
"fastify-plugin": "^5.0.1",
"googlevideo": "^2.0.0",
"googlevideo": "2.0.0",
"hyperid": "^3.1.1",
"jsdom": "^25.0.0",
"secure-json-parse": "^3.0.1",
"undici": "^7.0.0",
"youtubei.js": "11.0.1",
Expand All @@ -31,6 +30,7 @@
"devDependencies": {
"bgutils-js": "^3.0.0",
"@bret/type-provider-json-schema-to-ts": "^4.0.2",
"jsdom": "^25.0.0",
"@types/jsdom": "^21.1.7",
"@types/node": "^22.0.0",
"@voxpelli/tsconfig": "^15.0.0",
Expand Down
20 changes: 12 additions & 8 deletions routes/unified/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,24 @@ export default async function ytDlpRoute (fastify, _opts) {
const parsedUrl = new URL(url)

if (isYouTubeUrl(parsedUrl)) {
const results = await fastify.youtubei.onesieFormatRequest(
parsedUrl.toString(),
format,
fastify.youtubei.innertube,
fastify.youtubei.tvConfig
)
return results
try {
const results = await fastify.youtubei.onesieFormatRequest(
parsedUrl.toString(),
format,
fastify.youtubei.innertube,
fastify.youtubei.tvConfig
)
return results
} catch (err) {
request.log.error(err, 'Error when running onesie request')
throw err
}
} else {
try {
const params = new URLSearchParams({
url,
format: ytDlpFormats[format]
})

const response = await undiciRequest(
`http://${fastify.config.YTDLPAPI_HOST}/info?${params.toString()}`,
{
Expand Down

0 comments on commit 85ad257

Please sign in to comment.