From 8493b1e3df011a84fa8e2c192a29955b257692d2 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Wed, 21 Apr 2021 14:12:09 +0800 Subject: [PATCH] GoogleVideoSearch: fix blank description; invalid thumbnails ## Issue Closes 5923 video metadata issues ## Notes For thumbnails, future claims should have correct thumbnails after `5925 Fix thumbnail-checking and block 'data:image'`. For existing claims, we'll just skip the metadata to avoid the crawler error. Users can easily update their thumbnails. For the `OlivOliv` thumbnail url case, I wasn't sure whether to go all out to fetch and verify each thumbnail. I ended up just checking whether it starts with `http(s)` --- web/src/html.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/src/html.js b/web/src/html.js index a310f45d7..ea5648297 100644 --- a/web/src/html.js +++ b/web/src/html.js @@ -191,11 +191,19 @@ function buildGoogleVideoMetadata(claimUri, claim) { thumbnailUrl: `${claimThumbnail}`, uploadDate: `${new Date(releaseTime * 1000).toISOString()}`, // --- Recommended --- - duration: moment.duration(claim.duration * 1000).toISOString(), + duration: claim.duration ? moment.duration(claim.duration * 1000).toISOString() : undefined, contentUrl: generateDirectUrl(claim.name, claim.claim_id), embedUrl: generateEmbedUrl(claim.name, claim.claim_id), }; + if ( + !googleVideoMetadata.description.replace(/\s/g, '').length || + googleVideoMetadata.thumbnailUrl.startsWith('data:image') || + !googleVideoMetadata.thumbnailUrl.startsWith('http') + ) { + return ''; + } + return ( '\n' );