mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
feat: Add axis studios (#4571)
This commit is contained in:
@@ -4,6 +4,17 @@ pageClass: routes
|
||||
|
||||
# 设计
|
||||
|
||||
## Axis Studios
|
||||
|
||||
### Work type
|
||||
|
||||
<Route author="MisteryMonster" example="/axis-studios/work/full-service-cg-production" path="/axis-studios/:type/:tag?" :paramsDesc="['`work`, `blog`','文章内的 Work type URL: `compositing`, `full-service-cg-production`, `vfx-supervision`, `realtime`, `art-direction`, `animation`']">
|
||||
|
||||
文章内 Work type 指向的栏目地址,比如: 'https://axisstudiosgroup.com/work/full-service-cg-production' 的 tag 为 `full-service-cg-production`,要注意的是 tag 和文章的目录是一样的。
|
||||
|
||||
有一些 tag 并不经常使用: `Script`, `direction`, `production`, `design-concept` 等等。
|
||||
|
||||
</Route>
|
||||
## Dribbble
|
||||
|
||||
### 流行
|
||||
|
||||
@@ -4,6 +4,18 @@ pageClass: routes
|
||||
|
||||
# Design
|
||||
|
||||
## Axis Studios
|
||||
|
||||
### Work type
|
||||
|
||||
<RouteEn author="MisteryMonster" example="/axis-studios/work/full-service-cg-production" path="/axis-studios/:type/:tag?" :paramsDesc="['`work`, `blog`', 'Work type URL: `compositing`, `full-service-cg-production`, `vfx-supervision`, `realtime`, `art-direction`, `animation`']">
|
||||
|
||||
Work type URL in articles. Such as: 'https://axisstudiosgroup.com/work/full-service-cg-production' the tag will be `full-service-cg-production`.
|
||||
|
||||
Some tags are rarely used: `Script`, `direction`, `production`, `design-concept` etc。
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Dribbble
|
||||
|
||||
### Popular
|
||||
|
||||
@@ -2574,6 +2574,9 @@ router.get('/zhuixinfan/list', require('./routes/zhuixinfan/list'));
|
||||
// scoresaber
|
||||
router.get('/scoresaber/user/:id', require('./routes/scoresaber/user'));
|
||||
|
||||
// axis-studios
|
||||
router.get('/axis-studios/:type/:tag?', require('./routes/axis-studios/work'));
|
||||
|
||||
// 人民邮电出版社
|
||||
router.get('/ptpress/book/:type?', require('./routes/ptpress/book'));
|
||||
|
||||
|
||||
82
lib/routes/axis-studios/work.js
Executable file
82
lib/routes/axis-studios/work.js
Executable file
@@ -0,0 +1,82 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { type, tag } = ctx.params || '';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://axisstudiosgroup.com/${type}/${tag}`,
|
||||
});
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML
|
||||
const list = $('a.overlay-link').get().slice(0, 13);
|
||||
const articledata = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const link = `https://axisstudiosgroup.com${$(item)
|
||||
.attr('href')
|
||||
.replace(/https:/, '')}`;
|
||||
|
||||
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);
|
||||
|
||||
$2('.slider-nav').remove(); // 图片导航
|
||||
$2('.social-wrapper').remove(); // 社交按钮
|
||||
$2('source').remove(); // 莫名其妙的图片
|
||||
$2('video').remove(); // 视频标签
|
||||
$2('button').remove(); // 按钮
|
||||
$2('div.modal.fade').remove(); // 莫名奇妙的图片
|
||||
$2('i').remove();
|
||||
|
||||
const youtube = $2('.mcdr.playlist-control a').attr('data-video-type') === 'video/youtube' ? $2('.mcdr.playlist-control a').attr('data-video-url').replace('https://www.youtube.com/watch?v=', '') : '';
|
||||
const mp4 = $2('.mcdr.playlist-control a').attr('data-video-type') === 'video/mp4' ? $2('.mcdr.playlist-control a').attr('data-video-url') : '';
|
||||
|
||||
const content = $2('.container-fluid>div:nth-child(2)')
|
||||
.html()
|
||||
.replace(/<video*.+poster=/g, '<video controls="controls" poster=')
|
||||
.replace(/<.?picture>/g, '')
|
||||
.replace(/<picture*.+>/g, '')
|
||||
.replace(/<div*.+>/g, '')
|
||||
.replace(/<.?div>/g, '')
|
||||
.replace(/<!--*.+-->/g, '');
|
||||
const single = {
|
||||
describe: content,
|
||||
title: $2('.overlay-content').find('h1').text(),
|
||||
link: link,
|
||||
mp4,
|
||||
youtube,
|
||||
};
|
||||
ctx.cache.set(link, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `Axis Studios | ${type} ${tag ? tag : ''}`,
|
||||
link: 'http://axisstudiosgroup.com',
|
||||
description: $('description').text(),
|
||||
item: list.map((item, index) => {
|
||||
let video = '';
|
||||
if (articledata[index].mp4) {
|
||||
video = `<video width="100%" controls="controls" width="640" height="360" source src="${articledata[index].mp4}" type="video/mp4"></video><br>`;
|
||||
}
|
||||
if (articledata[index].youtube) {
|
||||
video = `<iframe id="ytplayer" type="text/html" width="640" height="360" src='https://youtube.com/embed/${articledata[index].youtube}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><br>`;
|
||||
}
|
||||
return {
|
||||
title: `${articledata[index].title}`,
|
||||
description: `${video}+${articledata[index].describe}`,
|
||||
link: `${articledata[index].link}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user