Compare commits

..

No commits in common. "720640b0543180920c7d7a8eb858aef7053fc2f4" and "738b682f3e00ae69758ff0adf375c818225c26e7" have entirely different histories.

2 changed files with 5 additions and 14 deletions

View File

@ -21,7 +21,7 @@ export async function cachedVRCYoutubeSearch(pool, queryOrContinuation, options)
async function VRCYoutubeSearch(pool, query, options = {}) { async function VRCYoutubeSearch(pool, query, options = {}) {
console.debug("search:", JSON.stringify(query)); console.debug("search:", query);
var data = {results: []}; var data = {results: []};
var {videos, continuationData} = typeof query == "object" ? await continueYouTubeVideoSearch(query) : await searchYouTubeVideos(query); var {videos, continuationData} = typeof query == "object" ? await continueYouTubeVideoSearch(query) : await searchYouTubeVideos(query);
@ -38,13 +38,9 @@ async function VRCYoutubeSearch(pool, query, options = {}) {
iconUrls = [...iconUrls]; iconUrls = [...iconUrls];
} }
if (thumbnailUrls?.length || iconUrls?.length) { if (thumbnailUrls || iconUrls) {
try { var {vrcurl: imagesheet_vrcurl, thumbnails, icons} = await makeImageSheetVrcUrl(pool, thumbnailUrls, iconUrls);
var {vrcurl: imagesheet_vrcurl, thumbnails, icons} = await makeImageSheetVrcUrl(pool, thumbnailUrls, iconUrls); data.imagesheet_vrcurl = imagesheet_vrcurl;
data.imagesheet_vrcurl = imagesheet_vrcurl;
} catch (error) {
console.error(error.stack);
}
} }
for (let video of videos) { for (let video of videos) {

7
app.js
View File

@ -26,15 +26,10 @@ router.get("/search", async ctx => {
var options = { var options = {
thumbnails: stringToBoolean(ctx.query.thumbnails), thumbnails: stringToBoolean(ctx.query.thumbnails),
icons: stringToBoolean(ctx.query.icons), icons: stringToBoolean(ctx.query.icons)
ascii: stringToBoolean(ctx.query.ascii)
}; };
ctx.body = await cachedVRCYoutubeSearch(ctx.query.pool, query, options); ctx.body = await cachedVRCYoutubeSearch(ctx.query.pool, query, options);
if (options.ascii) {
ctx.body = JSON.stringify(ctx.body).replace(/[\u007F-\uFFFF]/g, chr => "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).slice(-4));
}
}); });