Compare commits
	
		
			3 Commits
		
	
	
		
			738b682f3e
			...
			720640b054
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 720640b054 | |||
| 1d818bd719 | |||
| 1c38cfc79c | 
@ -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:", query);
 | 
						console.debug("search:", JSON.stringify(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,9 +38,13 @@ async function VRCYoutubeSearch(pool, query, options = {}) {
 | 
				
			|||||||
		iconUrls = [...iconUrls];
 | 
							iconUrls = [...iconUrls];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (thumbnailUrls || iconUrls) {
 | 
						if (thumbnailUrls?.length || iconUrls?.length) {
 | 
				
			||||||
		var {vrcurl: imagesheet_vrcurl, thumbnails, icons} = await makeImageSheetVrcUrl(pool, thumbnailUrls, iconUrls);
 | 
							try {
 | 
				
			||||||
		data.imagesheet_vrcurl = imagesheet_vrcurl;
 | 
								var {vrcurl: imagesheet_vrcurl, thumbnails, icons} = await makeImageSheetVrcUrl(pool, thumbnailUrls, iconUrls);
 | 
				
			||||||
 | 
								data.imagesheet_vrcurl = imagesheet_vrcurl;
 | 
				
			||||||
 | 
							} catch (error) {
 | 
				
			||||||
 | 
								console.error(error.stack);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (let video of videos) {
 | 
						for (let video of videos) {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										7
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								app.js
									
									
									
									
									
								
							@ -26,10 +26,15 @@ 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));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user