mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
feat: Add blow studio (#4569)
This commit is contained in:
@@ -4,6 +4,12 @@ pageClass: routes
|
|||||||
|
|
||||||
# 设计
|
# 设计
|
||||||
|
|
||||||
|
## Blow Studio
|
||||||
|
|
||||||
|
### 主页
|
||||||
|
|
||||||
|
<Route author="MisteryMonster" example="/blow-studio" path="/blow-studio" />
|
||||||
|
|
||||||
## Axis Studios
|
## Axis Studios
|
||||||
|
|
||||||
### Work type
|
### Work type
|
||||||
@@ -15,6 +21,7 @@ pageClass: routes
|
|||||||
有一些 tag 并不经常使用: `Script`, `direction`, `production`, `design-concept` 等等。
|
有一些 tag 并不经常使用: `Script`, `direction`, `production`, `design-concept` 等等。
|
||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
## Dribbble
|
## Dribbble
|
||||||
|
|
||||||
### 流行
|
### 流行
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ pageClass: routes
|
|||||||
|
|
||||||
# Design
|
# Design
|
||||||
|
|
||||||
|
## Blow Studio
|
||||||
|
|
||||||
|
### Home
|
||||||
|
|
||||||
|
<RouteEn author="MisteryMonster" example="/blow-studio" path="/blow-studio" />
|
||||||
|
|
||||||
## Axis Studios
|
## Axis Studios
|
||||||
|
|
||||||
### Work type
|
### Work type
|
||||||
|
|||||||
@@ -2574,6 +2574,9 @@ router.get('/zhuixinfan/list', require('./routes/zhuixinfan/list'));
|
|||||||
// scoresaber
|
// scoresaber
|
||||||
router.get('/scoresaber/user/:id', require('./routes/scoresaber/user'));
|
router.get('/scoresaber/user/:id', require('./routes/scoresaber/user'));
|
||||||
|
|
||||||
|
// blow-studio
|
||||||
|
router.get('/blow-studio', require('./routes/blow-studio/work'));
|
||||||
|
|
||||||
// axis-studios
|
// axis-studios
|
||||||
router.get('/axis-studios/:type/:tag?', require('./routes/axis-studios/work'));
|
router.get('/axis-studios/:type/:tag?', require('./routes/axis-studios/work'));
|
||||||
|
|
||||||
|
|||||||
71
lib/routes/blow-studio/work.js
Executable file
71
lib/routes/blow-studio/work.js
Executable file
@@ -0,0 +1,71 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `http://blowstudio.es/work`,
|
||||||
|
});
|
||||||
|
const data = response.data;
|
||||||
|
const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML
|
||||||
|
const list = $('.portfolios.normal > ul > li').get().slice(0, 10);
|
||||||
|
const articledata = await Promise.all(
|
||||||
|
list.map(async (item) => {
|
||||||
|
const link = `https://www.blowstudio.es${$(item).find('a').attr('href')}`;
|
||||||
|
|
||||||
|
const cache = await ctx.cache.get(link);
|
||||||
|
if (cache) {
|
||||||
|
return Promise.resolve(JSON.parse(cache));
|
||||||
|
}
|
||||||
|
|
||||||
|
const response2 = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: link,
|
||||||
|
});
|
||||||
|
|
||||||
|
const articleHtml = response2.data;
|
||||||
|
const $2 = cheerio.load(articleHtml);
|
||||||
|
const imglist = $2('div.attachment-grid img').get();
|
||||||
|
const mainvideo = $2('.single-page-vimeo-div').attr('data-video-id');
|
||||||
|
|
||||||
|
const img = imglist.map((item) => ({
|
||||||
|
img: $2(item).attr('src'),
|
||||||
|
}));
|
||||||
|
const single = {
|
||||||
|
mainvideo,
|
||||||
|
describe: $2('div.portfolio-content > div:nth-child(2)').html(),
|
||||||
|
title: $2('div.portfolio-content > div:nth-child(1)').text(),
|
||||||
|
images: img,
|
||||||
|
link: link,
|
||||||
|
};
|
||||||
|
ctx.cache.set(link, JSON.stringify(single));
|
||||||
|
return Promise.resolve(single);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: 'Blow Studio',
|
||||||
|
link: 'http://blowstudio.es',
|
||||||
|
description: $('description').text(),
|
||||||
|
item: list.map((item, index) => {
|
||||||
|
let content = '';
|
||||||
|
const videostyle = `width="640" height="360"`;
|
||||||
|
const imgstyle = `style="max-width: 650px; height: auto; object-fit: contain; flex: 0 0 auto;"`;
|
||||||
|
|
||||||
|
content += `<iframe ${videostyle} src='https://player.vimeo.com/video/${articledata[index].mainvideo}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><br>`;
|
||||||
|
content += `${articledata[index].describe}`;
|
||||||
|
|
||||||
|
if (articledata[index].images) {
|
||||||
|
for (let p = 0; p < articledata[index].images.length; p++) {
|
||||||
|
content += `<img ${imgstyle} src="${articledata[index].images[p].img}"><br>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: `${articledata[index].title}`,
|
||||||
|
description: `${content}`,
|
||||||
|
link: `${articledata[index].link}`,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user