feat(route): Add 上海文化广场 - 节目列表 (#12761)
* feat(route): Add 上海文化广场 - 节目列表 * feat(route): include full article content for shcstheatre * fix(route): correct image urls for shcstheatre * fix(route): fix typo in shcstheatre * refactor(route): shcstheatre: hide the titles for empty section * doc: document shcstheatre * feat(radar): : add rule for shcstheatre * fix(route): use cache for shcstheatre * feat(route): add cover image for shcstheatre * refactor(route): move description.art to templates subdir * Update lib/v2/shcstheatre/programs.js * Update lib/v2/shcstheatre/programs.js * Update lib/v2/shcstheatre/programs.js * Update lib/v2/shcstheatre/radar.js * fix: use path.join() instead of string concatenation ---------
This commit is contained in:
@@ -443,6 +443,12 @@ For instance, in <https://www.zagg.com/en_us/new-arrivals?brand=164&cat=3038%2C3
|
||||
|
||||
<Route author="hoilc" example="/ptpress/book/new" path="/ptpress/book/:type?" :paramsDesc="['排序方式,默认`new`为最新图书,可选`hot`为最热图书']"/>
|
||||
|
||||
## 上海文化广场
|
||||
|
||||
### 节目列表
|
||||
|
||||
<Route author="fuzy112" example="/shcstheatre/programs" path="/shcstheatre/programs"/>
|
||||
|
||||
## 什么值得买
|
||||
|
||||
::: tip 提示
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/programs': ['fuzy112'],
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const cheerio = require('cheerio');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.shcstheatre.com/Program/programList.aspx';
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const items = await Promise.all(
|
||||
$('#datarow .program-name a').map((_, elem) => {
|
||||
const link = new URL($(elem).attr('href'), url);
|
||||
return ctx.cache.tryGet(link.toString(), async () => {
|
||||
const id = link.searchParams.get('id');
|
||||
const res2 = await got.post('https://www.shcstheatre.com/webapi.ashx?op=GettblprogramCache', {
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
|
||||
form: { id },
|
||||
});
|
||||
const data = res2.data.data.tblprogram[0];
|
||||
return {
|
||||
title: data.SCS_WEB_BRIEFNAME,
|
||||
link: link.toString(),
|
||||
description: art(path.join(__dirname, 'templates/description.art'), data),
|
||||
pubDate: timezone(parseDate(data.SJ_DATE_PC), +8),
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
const image = $('.menu-logo img').attr('src');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '上海文化广场 - 节目列表',
|
||||
link: url,
|
||||
image,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'shcstheatre.com': {
|
||||
_name: '上海文化广场',
|
||||
www: [
|
||||
{
|
||||
title: '节目列表',
|
||||
docs: 'https://docs.rsshub.app/shopping.html#shang-hai-wen-hua-guang-chang-jie-mu-lie-biao',
|
||||
source: ['/Program/programList.aspx'],
|
||||
target: '/shcstheatre/programs',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/programs', require('./programs'));
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
<div>
|
||||
{{ if SCS_PC_YMXQ_PIC }}
|
||||
{{ each SCS_PC_YMXQ_PIC.split(';').map(s => s.trim() )}}
|
||||
<img src="https://www.shcstheatre.com{{ $value }}" />
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
|
||||
<ul>
|
||||
<li>演出日期:{{ SCS_WEBPERCYCLE }}</li>
|
||||
<li>入场时间:{{ SCS_EINLASSNAME }}</li>
|
||||
<li>演出类型:{{ SCS_PERFORMANCE_TYPENAME }}</li>
|
||||
<li>演出时长:{{ SCS_LENGTH }}分钟</li>
|
||||
<li>演出语言:{{ SCS_PERLANGUAGENAME }}</li>
|
||||
</ul>
|
||||
|
||||
{{ if SCS_PC_LUNBO_YCJS_EDITOR }}
|
||||
<h1>演出介绍</h1>
|
||||
{{ if SCS_PC_LUNBO_YCJS_PIC }}
|
||||
{{ each SCS_PC_LUNBO_YCJS_PIC.split(';').map(s => s.trim()) }}
|
||||
<img src="https://www.shcstheatre.com{{ $value }}" />
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
<div> {{@ SCS_PC_LUNBO_YCJS_EDITOR }} </div>
|
||||
{{ /if }}
|
||||
|
||||
{{ if SCS_PC_LUNBO_ZCTD_EDITOR }}
|
||||
<h1>主创团队</h1>
|
||||
{{ if SCS_PC_LUNBO_ZCTD_PIC }}
|
||||
{{ each SCS_PC_LUNBO_ZCTD_PIC.split(';').map(s => s.trim()) }}
|
||||
<img src="https://www.shcstheatre.com{{ $value }}" />
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
<div> {{@ SCS_PC_LUNBO_ZCTD_EDITOR }} </div>
|
||||
{{ /if }}
|
||||
|
||||
{{ if SCS_PC_LUNBO_JQGG_EDITOR }}
|
||||
<h1>剧情梗概</h1>
|
||||
{{ if SCS_PC_LUNBO_JQGG_PIC }}
|
||||
{{ each SCS_PC_LUNBO_JQGG_PIC.split(';').map(s => s.trim()) }}
|
||||
<img src="https://www.shcstheatre.com{{ $value }}" />
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
<div> {{@ SCS_PC_LUNBO_JQGG_EDITOR }} </div>
|
||||
{{ /if }}
|
||||
|
||||
{{ if SCS_PC_LUNBO_HJJL_EDITOR }}
|
||||
<h1>获奖记录</h1>
|
||||
{{ if SCS_PC_LUNBO_HJJL_PIC }}
|
||||
{{ each SCS_PC_LUNBO_HJJL_PIC.split(';').map(s => s.trim()) }}
|
||||
<img src="https://www.shcstheatre.com{{ $value }}" />
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
<div> {{@ SCS_PC_LUNBO_HJJL_EDITOR }} </div>
|
||||
{{ /if }}
|
||||
|
||||
{{ if SCS_PC_LUNBO_MTPL_EDITOR }}
|
||||
<h1>媒体评论</h1>
|
||||
{{ if SCS_PC_LUNBO_MTPL_PIC }}
|
||||
{{ each SCS_PC_LUNBO_MTPL_PIC.split(';').map(s => s.trim()) }}
|
||||
<img src="https://www.shcstheatre.com{{ $value }}" />
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
<div> {{@ SCS_PC_LUNBO_MTPL_EDITOR }} </div>
|
||||
{{ /if }}
|
||||
</div>
|
||||
Reference in New Issue
Block a user