fix(route): fetch articles from osc.cool (#15776)

This commit is contained in:
Tony 2024-05-31 14:41:03 +08:00 committed by GitHub
parent abbebfbd24
commit 1f619e46e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import got from '@/utils/got';
import { parseDate, parseRelativeDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
import { load } from 'cheerio';
import { fetchArticle } from '@/utils/wechat-mp';
const configs = {
all: {
@ -111,8 +112,7 @@ async function handler(ctx) {
item.description = content('.article-detail').html();
item.author = content('.article-box__meta .item').first().text();
}
if (/^https?:\/\/gitee.com\/.*$/.test(item.link)) {
} else if (/^https?:\/\/gitee\.com\/.*$/.test(item.link)) {
const detail = await got(item.link, {
headers: {
Referer: config.link,
@ -121,6 +121,8 @@ async function handler(ctx) {
const content = load(detail.data);
item.description = content('.file_content').html();
} else if (/^https?:\/\/osc\.cool\/.*$/.test(item.link)) {
return fetchArticle(item.link, true);
}
return item;
})