* refactor: fix all get * fix(utils/common-config): charset case compare * Revert "fix(utils/common-config): charset case compare" This reverts commit 3c1880f2fad53ad2cafddcee7741390fd46fa3d2. * fix: nga * fix: notateslaapp * fix: ps * fix: xjtu * fix: enforce error on restricted syntax for get calls * fix: eslint * fix: more eslint
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { Route } from '@/types';
|
|
import got from '@/utils/got';
|
|
import { load } from 'cheerio';
|
|
|
|
export const route: Route = {
|
|
path: '/movie/later',
|
|
categories: ['social-media'],
|
|
example: '/douban/movie/later',
|
|
parameters: {},
|
|
features: {
|
|
requireConfig: false,
|
|
requirePuppeteer: false,
|
|
antiCrawler: false,
|
|
supportBT: false,
|
|
supportPodcast: false,
|
|
supportScihub: false,
|
|
},
|
|
name: '即将上映的电影',
|
|
maintainers: ['DIYgod'],
|
|
handler,
|
|
};
|
|
|
|
async function handler() {
|
|
const response = await got({
|
|
method: 'get',
|
|
url: 'https://movie.douban.com/cinema/later/beijing/',
|
|
});
|
|
const $ = load(response.data);
|
|
|
|
const item = $('#showing-soon .item')
|
|
.toArray()
|
|
.map((ele) => {
|
|
const description = $(ele).html();
|
|
const name = $('h3', ele).text().trim();
|
|
const date = $('ul li', ele).eq(0).text().trim();
|
|
const type = $('ul li', ele).eq(1).text().trim();
|
|
const link = $('a.thumb', ele).attr('href');
|
|
|
|
return {
|
|
title: `${date} - 《${name}》 - ${type}`,
|
|
link,
|
|
description,
|
|
};
|
|
});
|
|
|
|
return {
|
|
title: '即将上映的电影',
|
|
link: 'https://movie.douban.com/cinema/later/',
|
|
item,
|
|
};
|
|
}
|