feat(route): add 35PHOTO (#9267)
This commit is contained in:
parent
2f01aa6819
commit
b808cdb78f
|
|
@ -38,6 +38,32 @@ pageClass: routes
|
|||
|
||||
</RouteEn>
|
||||
|
||||
## 35PHOTO
|
||||
|
||||
### New photos
|
||||
|
||||
<RouteEn author="nczitzk" example="/35photo/new" path="/35photo/new"/>
|
||||
|
||||
### Featured photos
|
||||
|
||||
<RouteEn author="nczitzk" example="/35photo/actual" path="/35photo/actual"/>
|
||||
|
||||
### New interesting
|
||||
|
||||
<RouteEn author="nczitzk" example="/35photo/interesting" path="/35photo/interesting"/>
|
||||
|
||||
### Photos on the world map
|
||||
|
||||
<RouteEn author="nczitzk" example="/35photo/map" path="/35photo/map"/>
|
||||
|
||||
### Genre
|
||||
|
||||
<RouteEn author="nczitzk" example="/35photo/genre/99" path="/35photo/genre/:id" :paramsDesc="['id, can be found in URL']"/>
|
||||
|
||||
### Author
|
||||
|
||||
<RouteEn author="nczitzk" example="/35photo/author/mariuszsix" path="/35photo/author/:id" :paramsDesc="['id, can be found in URL']"/>
|
||||
|
||||
## Asian to lick
|
||||
|
||||
### Home
|
||||
|
|
|
|||
|
|
@ -38,6 +38,32 @@ pageClass: routes
|
|||
|
||||
</Route>
|
||||
|
||||
## 35PHOTO
|
||||
|
||||
### New photos
|
||||
|
||||
<Route author="nczitzk" example="/35photo/new" path="/35photo/new"/>
|
||||
|
||||
### Featured photos
|
||||
|
||||
<Route author="nczitzk" example="/35photo/actual" path="/35photo/actual"/>
|
||||
|
||||
### New interesting
|
||||
|
||||
<Route author="nczitzk" example="/35photo/interesting" path="/35photo/interesting"/>
|
||||
|
||||
### Photos on the world map
|
||||
|
||||
<Route author="nczitzk" example="/35photo/map" path="/35photo/map"/>
|
||||
|
||||
### Genre
|
||||
|
||||
<Route author="nczitzk" example="/35photo/genre/99" path="/35photo/genre/:id" :paramsDesc="['id,可在对应分类页 URL 中找到']"/>
|
||||
|
||||
### Author
|
||||
|
||||
<Route author="nczitzk" example="/35photo/author/mariuszsix" path="/35photo/author/:id" :paramsDesc="['id,可在对应作者页 URL 中找到']"/>
|
||||
|
||||
## 8KCosplay
|
||||
|
||||
### 最新
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${rootUrl}/new/actual`;
|
||||
|
||||
ctx.state.data = await ProcessItems(currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const currentUrl = `${rootUrl}/${id}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const currentUrl = `${rootUrl}/genre_${id}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${rootUrl}/new/interesting`;
|
||||
|
||||
ctx.state.data = await ProcessItems(currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
'/actual': ['nczitzk'],
|
||||
'/author/:id': ['nczitzk'],
|
||||
'/genre/:id': ['nczitzk'],
|
||||
'/interesting': ['nczitzk'],
|
||||
'/map': ['nczitzk'],
|
||||
'/new': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${rootUrl}/new/map`;
|
||||
|
||||
ctx.state.data = await ProcessItems(currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${rootUrl}/new`;
|
||||
|
||||
ctx.state.data = await ProcessItems(currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
module.exports = {
|
||||
'35photo.pro': {
|
||||
_name: '35PHOTO',
|
||||
'.': [
|
||||
{
|
||||
title: 'New photos',
|
||||
docs: 'https://docs.rsshub.app/picture.html#35photo-new-photos',
|
||||
source: ['/new', '/'],
|
||||
target: '/35photo/new',
|
||||
},
|
||||
{
|
||||
title: 'Featured photos',
|
||||
docs: 'https://docs.rsshub.app/picture.html#35photo-featured-photos',
|
||||
source: ['/new/actual', '/'],
|
||||
target: '/35photo/actual',
|
||||
},
|
||||
{
|
||||
title: 'New interesting',
|
||||
docs: 'https://docs.rsshub.app/picture.html#35photo-new-interesting',
|
||||
source: ['/new/interesting', '/'],
|
||||
target: '/35photo/interesting',
|
||||
},
|
||||
{
|
||||
title: 'Photos on the world map',
|
||||
docs: 'https://docs.rsshub.app/picture.html#35photo-photos-on-the-world-map',
|
||||
source: ['/new/map', '/'],
|
||||
target: '/35photo/map',
|
||||
},
|
||||
{
|
||||
title: 'Genre',
|
||||
docs: 'https://docs.rsshub.app/picture.html#35photo-genre',
|
||||
source: ['/'],
|
||||
target: (params, url) => `/35photo/genre/${url.match(/genre_(\d+)/)[1]}`,
|
||||
},
|
||||
{
|
||||
title: 'Author',
|
||||
docs: 'https://docs.rsshub.app/picture.html#35photo-author',
|
||||
source: ['/:id', '/'],
|
||||
target: '/35photo/author/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/actual', require('./actual'));
|
||||
router.get('/author/:id', require('./author'));
|
||||
router.get('/genre/:id', require('./genre'));
|
||||
router.get('/interesting', require('./interesting'));
|
||||
router.get('/map', require('./map'));
|
||||
router.get('/new', require('./new'));
|
||||
};
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const rootUrl = 'https://35photo.pro';
|
||||
|
||||
module.exports = {
|
||||
rootUrl,
|
||||
ProcessItems: async (currentUrl) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.item')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const image = item.find('.showPrevPhoto');
|
||||
|
||||
return {
|
||||
title: image.attr('title').replace(/Photographer\\'s photo - /, ''),
|
||||
link: image.parent().attr('href'),
|
||||
author: item.next().find('.userName').text().replace(/© /, ''),
|
||||
category: image
|
||||
.attr('alt')
|
||||
.replace(/photo preview/g, '')
|
||||
.split(/,|#/)
|
||||
.map((c) => c.trim()),
|
||||
description: `<img src="${rootUrl}/photos_main/${image.attr('src').match(/sizes\/(.*)_/)[1]}.jpg">`,
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
title: `${$('h1').text()} - 35PHOTO`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
},
|
||||
};
|
||||
Loading…
Reference in New Issue