Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from diygod:master #317

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions lib/routes-deprecated/dytt/index.js

This file was deleted.

75 changes: 75 additions & 0 deletions lib/routes/dytt/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import type { Route } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
import iconv from 'iconv-lite';
import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/',
categories: ['multimedia'],
example: '/dytt',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: true,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['ygdy8.net/index.html'],
},
],
name: '最新电影',
maintainers: ['junfengP'],
handler,
};

async function loadContent(link: string) {
const response = await got.get(link, {
responseType: 'buffer',
});
const data = iconv.decode(response.data, 'gb2312');
const $ = load(data);
return $('div#Zoom').html() || '';
}

async function handler() {
const baseURL = 'https://www.ygdy8.net/html/gndy/dyzz/index.html';
const response = await got.get(baseURL, {
responseType: 'buffer',
});
const data = iconv.decode(response.data, 'gb2312');

const $ = load(data);
const list = $('.co_content8 table tr b a').toArray();

const items = await Promise.all(
list.map(async (item) => {
const link = $(item);
const itemUrl = 'https://www.ygdy8.net' + link.attr('href');

return await cache.tryGet(itemUrl, async () => {
const description = await loadContent(itemUrl);
return {
enclosure_url: description.match(/magnet:.*?(?=">)/) || '',
enclosure_type: 'application/x-bittorrent',
title: link.text(),
description,
pubDate: parseDate($(item).find('font').text()),
link: itemUrl,
};
});
})
);

return {
title: '电影天堂/阳光电影',
link: baseURL,
description: '电影天堂RSS',
item: items,
};
}
7 changes: 7 additions & 0 deletions lib/routes/dytt/namespace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Namespace } from '@/types';

export const namespace: Namespace = {
name: '电影天堂',
url: 'www.ygdy8.net',
lang: 'zh-CN',
};
Loading