diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 963d9c2d8..622e84711 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -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: [ diff --git a/docs/picture.md b/docs/picture.md index 753c64067..2d1d70087 100644 --- a/docs/picture.md +++ b/docs/picture.md @@ -50,6 +50,12 @@ pageClass: routes +## Google 相册 + +### 公开影集 + + + ## Konachan Anime Wallpapers ::: tip 提示 diff --git a/lib/router.js b/lib/router.js index bd9ff4c67..7b891de02 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/google/album.js b/lib/routes/google/album.js new file mode 100644 index 000000000..fb9319510 --- /dev/null +++ b/lib/routes/google/album.js @@ -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 ? `