From ee30e7fb54bc623be6539eae6a3ba60c49c57680 Mon Sep 17 00:00:00 2001 From: hoilc Date: Tue, 19 May 2020 16:26:06 +0800 Subject: [PATCH] fix: google album redirect url (#4814) --- lib/routes/google/album.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/routes/google/album.js b/lib/routes/google/album.js index fb93195107..bfcef06732 100644 --- a/lib/routes/google/album.js +++ b/lib/routes/google/album.js @@ -3,13 +3,11 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { const id = ctx.params.id; - const url = `https://photos.app.goo.gl/${id}`; + const url = `https://photos.app.goo.gl/${id}?_imcp=1`; - const init_response = await got.get(url); + const response = await got.get(url); - const real_url = init_response.data.match(/data-destination="(.*?)"/)[1]; - - const response = await got.get(real_url); + const real_url = response.request.options.url.href; const info = JSON.parse(response.data.match(/AF_initDataCallback.*?return ([\s\S]*?)}}\)/m)[1]) || []; @@ -23,7 +21,7 @@ module.exports = async (ctx) => { link: url, item: list.slice(0, 50).map((item) => { const time = new Date(item[2] * 1); - const isVideo = Object.keys(item[13]).length > 2; // uncertain + const isVideo = Object.keys(item[15]).length > 2; // uncertain const description = isVideo ? `