mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 06:30:40 +08:00
* Add(route): add Google Fonts and change to V2 * Fix(route): added throw error when API key is underfined * Fix(docs): add warning container * Fix(docs): Update docs/design.md Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Fix(route): sort routes * Fix(route): Update lib/v2/google/fonts.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> Co-authored-by: Tony <TonyRL@users.noreply.github.com>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
const got = require('@/utils/got');
|
|
|
|
module.exports = async (ctx) => {
|
|
const id = ctx.params.id;
|
|
|
|
const url = `https://photos.app.goo.gl/${id}?_imcp=1`;
|
|
|
|
const response = await got.get(url);
|
|
|
|
const real_url = response.request.options.url.href;
|
|
|
|
const info = JSON.parse(response.data.match(/AF_initDataCallback.*?data:(\[[\s\S]*\])\s/m)[1]) || [];
|
|
|
|
const album_name = info[3][1];
|
|
const owner_name = info[3][5][2];
|
|
|
|
const list = info[1];
|
|
|
|
ctx.state.data = {
|
|
title: `${owner_name} 创建的 Google 相册 - ${album_name}`,
|
|
link: url,
|
|
item: list.slice(0, 50).map((item) => {
|
|
const time = new Date(item[2] * 1);
|
|
const isVideo = Object.keys(item[15]).length > 2; // uncertain
|
|
const description = isVideo ? `<video src="${item[1][0]}=m18" controls controlslist="nodownload" loop style="max-width: 100%;">` : `<img src="${item[1][0]}=w${item[1][1]}-h${item[1][2]}-no" style="max-width: 100%;">`;
|
|
return {
|
|
title: time.toLocaleString(),
|
|
author: album_name,
|
|
description,
|
|
pubDate: time,
|
|
link: real_url.replace('?', `/photo/${item[0]}?`),
|
|
guid: item[0],
|
|
};
|
|
}),
|
|
};
|
|
};
|