feat: add google album (#3940)
This commit is contained in:
parent
bb016e2b9d
commit
da56486b00
|
|
@ -1107,6 +1107,18 @@
|
|||
},
|
||||
],
|
||||
},
|
||||
'google.com': {
|
||||
_name: '谷歌',
|
||||
photos: [
|
||||
{
|
||||
title: '相册',
|
||||
docs: 'https://docs.rsshub.app/picture.html#google-xiang-ce',
|
||||
source: '/share/*',
|
||||
target: '/google/album/:id',
|
||||
script: "({id: document.querySelector('html').innerHTML.match(/photos.app.goo.gl\\/(.*?)\"/)[1]})",
|
||||
},
|
||||
],
|
||||
},
|
||||
'javlibrary.com': {
|
||||
_name: 'javlibrary',
|
||||
www: [
|
||||
|
|
|
|||
|
|
@ -50,6 +50,12 @@ pageClass: routes
|
|||
|
||||
<Route author="xyqfer" example="/google/doodles/zh-CN" path="/google/doodles/:language?" :paramsDesc="['语言,默认为`zh-CN`简体中文,如需其他语言值可从[Google Doodles 官网](https://www.google.com/doodles)获取']" />
|
||||
|
||||
## Google 相册
|
||||
|
||||
### 公开影集
|
||||
|
||||
<Route author="hoilc" example="/google/album/msFFnAzKmQmWj76EA" path="/google/album/:id" :paramsDesc="['影集 ID, 可在 URL 中找到, 例如, 分享链接为`https://photos.app.goo.gl/msFFnAzKmQmWj76EA`, 则 ID 为`msFFnAzKmQmWj76EA`']" radar="1" />
|
||||
|
||||
## Konachan Anime Wallpapers
|
||||
|
||||
::: tip 提示
|
||||
|
|
|
|||
|
|
@ -481,6 +481,7 @@ router.get('/nvidia/webdriverupdate', require('./routes/nvidia/webdriverupdate')
|
|||
router.get('/google/citations/:id', require('./routes/google/citations'));
|
||||
router.get('/google/scholar/:query', require('./routes/google/scholar'));
|
||||
router.get('/google/doodles/:language?', require('./routes/google/doodles'));
|
||||
router.get('/google/album/:id', require('./routes/google/album'));
|
||||
|
||||
// Awesome Pigtals
|
||||
router.get('/pigtails', require('./routes/pigtails'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const url = `https://photos.app.goo.gl/${id}`;
|
||||
|
||||
const init_response = await got.get(url);
|
||||
|
||||
const real_url = init_response.data.match(/data-destination="(.*?)"/)[1];
|
||||
|
||||
const response = await got.get(real_url);
|
||||
|
||||
const info = JSON.parse(response.data.match(/AF_initDataCallback.*?return ([\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[13]).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: description,
|
||||
pubDate: time,
|
||||
link: real_url.replace('?', `/photo/${item[0]}?`),
|
||||
guid: item[0],
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue