/
recent-show.ts
101 lines (91 loc) 路 2.98 KB
/
recent-show.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
import path from 'node:path';
import { art } from '@/utils/render';
import { parseDate } from '@/utils/parse-date';
export const route: Route = {
path: '/recent-show',
categories: ['shopping'],
example: '/shoac/recent-show',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shoac.com.cn/'],
},
],
name: '婕斿嚭鏈堝巻',
maintainers: ['TonyRL'],
handler,
url: 'shoac.com.cn/',
};
async function handler() {
const baseUrl = 'https://www.shoac.com.cn';
const headers = {
Channel: 'theatre_pc',
Location: '121.458563,31.250315',
Theater: 1323,
'Flagship-Store': true,
};
const { data: products } = await got.post(`${baseUrl}/platform-backend/good/theater/dongyi-products`, {
headers,
json: {
page: 1,
size: 12,
calendar: false,
timeSort: true,
venueId: '',
},
});
const list = products.data.records.map((item) => ({
title: item.productNameShort,
category: [item.categoryName, item.subCategoryName],
link: `${baseUrl}/#/detail?projectId=${item.projectId}`,
projectId: item.projectId,
minPrice: item.minPrice,
maxPrice: item.maxPrice,
placeCname: item.placeCname,
}));
const items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link, async () => {
const { data: detail } = await got(`${baseUrl}/platform-backend/good/project/detail/old/${item.projectId}`, {
headers,
searchParams: {
distributionSeriesId: '',
distributionChannelId: '',
},
});
const { data: show } = await got(`${baseUrl}/platform-backend/good/shows/old/${item.projectId}`, {
headers,
searchParams: {
distributionSeriesId: '',
distributionChannelId: '',
},
});
item.description = art(path.join(__dirname, 'templates/detail.art'), {
item,
detail: detail.data,
show: show.data,
});
item.pubDate = show.data.showInfoDetailList ? parseDate(show.data.showInfoDetailList[0].saleBeginTime, 'x') : null;
return item;
})
)
);
return {
title: '婕斿嚭鏈堝巻 - 涓婃捣涓滄柟鑹烘湳涓績绠$悊鏈夐檺鍏徃',
link: baseUrl,
item: items,
};
}