Browse Source

cover image url improve

master
filesite 1 year ago
parent
commit
1260b6ddbb
  1. 3
      bot/Bilibili.mjs

3
bot/Bilibili.mjs

@ -60,9 +60,10 @@ class Bilibili extends HeroBot {
//get cover image's base64 data //get cover image's base64 data
//sample: //i1.hdslb.com/bfs/archive/ef6204c8788134064dc6b7e8cb20870f1341e604.jpg@100w_100h_1c.png //sample: //i1.hdslb.com/bfs/archive/ef6204c8788134064dc6b7e8cb20870f1341e604.jpg@100w_100h_1c.png
//替换成://i1.hdslb.com/bfs/archive/ef6204c8788134064dc6b7e8cb20870f1341e604.jpg@480w_270h_1c.png
if (typeof(data.cover) != 'undefined' && data.cover) { if (typeof(data.cover) != 'undefined' && data.cover) {
data.cover = common.getAbsoluteUrl(data.cover); data.cover = common.getAbsoluteUrl(data.cover);
data.cover = data.cover.replace(/@[\w\.]+$/ig, ''); data.cover = data.cover.replace(/@[\w]+\./ig, '@480w_270h_1c.');
const response = await hero.goto(data.cover); const response = await hero.goto(data.cover);
const imgBuffer = await response.buffer; const imgBuffer = await response.buffer;

Loading…
Cancel
Save