-
Notifications
You must be signed in to change notification settings - Fork 8k
feat(route): add new routes 52pojie ghxi sohumobile #18941
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Route } from '@/types'; | ||
import ofetch from '@/utils/ofetch'; | ||
import { load } from 'cheerio'; | ||
import iconv from 'iconv-lite'; | ||
|
||
export const route: Route = { | ||
path: '/jinpin', | ||
categories: ['bbs'], | ||
example: '/52pojie/jinpin', | ||
parameters: {}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
radar: [ | ||
{ | ||
source: ['www.52pojie.cn'], | ||
}, | ||
], | ||
name: '52pojie精品软件区最新发贴', | ||
maintainers: ['asqwe1'], | ||
handler: async () => { | ||
const response = await ofetch(`https://www.52pojie.cn/forum.php?mod=forumdisplay&fid=16&filter=author&orderby=dateline`, { | ||
responseType: 'arrayBuffer', // 获取原始二进制数据 | ||
}); | ||
const decodedHtml = iconv.decode(Buffer.from(response), 'gbk'); // 手动解码 GBK | ||
const $ = load(decodedHtml); // 加载解码后的 HTML | ||
const items = $('tbody[id^="normalthread"] > tr > th') | ||
// 使用“toArray()”方法将选择的所有 DOM 元素以数组的形式返回。 | ||
.toArray() | ||
// 使用“map()”方法遍历数组,并从每个元素中解析需要的数据。 | ||
.map((item) => { | ||
item = $(item); | ||
const a = item.find('a.s.xst').first(); | ||
return { | ||
title: a.text(), | ||
link: `https://www.52pojie.cn/${a.attr('href')}`, | ||
}; | ||
}); | ||
// 在此处编写路由处理函数 | ||
return { | ||
// 源标题 | ||
title: `52pojie精品软件区最新发贴`, | ||
// 源链接 | ||
link: `https://www.52pojie.cn/forum.php?mod=forumdisplay&fid=16&filter=author&orderby=dateline`, | ||
// 源文章 | ||
item: items, | ||
}; | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { Namespace } from '@/types'; | ||
|
||
export const namespace: Namespace = { | ||
name: '52pojie', | ||
url: 'm.sohu.com', | ||
description: '52pojie 精品软件区最新发贴', | ||
zh: { | ||
name: '吾爱破解网', | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,52 @@ | ||||||||||
import { Route } from '@/types'; | ||||||||||
import ofetch from '@/utils/ofetch'; | ||||||||||
import { load } from 'cheerio'; | ||||||||||
|
||||||||||
export const route: Route = { | ||||||||||
path: '/homepage', | ||||||||||
categories: ['other'], | ||||||||||
example: '/ghxi/homepage', | ||||||||||
parameters: {}, | ||||||||||
features: { | ||||||||||
requireConfig: false, | ||||||||||
requirePuppeteer: false, | ||||||||||
antiCrawler: false, | ||||||||||
supportBT: false, | ||||||||||
supportPodcast: false, | ||||||||||
supportScihub: false, | ||||||||||
}, | ||||||||||
radar: [ | ||||||||||
{ | ||||||||||
source: ['www.ghxi.com'], | ||||||||||
}, | ||||||||||
], | ||||||||||
name: '果核剥壳网-首页新贴', | ||||||||||
maintainers: ['asqwe1'], | ||||||||||
handler: async () => { | ||||||||||
const response = await ofetch(`https://www.ghxi.com/`); | ||||||||||
const $ = load(response); | ||||||||||
const items = $('#modules-4 > div > div.tab-wrap.active > ul > li > div.item-content') | ||||||||||
// 使用“toArray()”方法将选择的所有 DOM 元素以数组的形式返回。 | ||||||||||
.toArray() | ||||||||||
// 使用“map()”方法遍历数组,并从每个元素中解析需要的数据。 | ||||||||||
.map((item) => { | ||||||||||
item = $(item); | ||||||||||
const a = item.find('a').first(); | ||||||||||
const p = item.find('p').first(); | ||||||||||
return { | ||||||||||
title: a.text(), | ||||||||||
link: String(a.attr('href')), | ||||||||||
content: p.text(), | ||||||||||
}; | ||||||||||
Comment on lines
+36
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines 48 to 51 in b98b497
This site provides its full article RSS feed at https://www.ghxi.com/feed which provides way more information than this feed. |
||||||||||
}); | ||||||||||
// 在此处编写路由处理函数 | ||||||||||
return { | ||||||||||
// 源标题 | ||||||||||
title: `果核剥壳网-首页新贴`, | ||||||||||
// 源链接 | ||||||||||
link: `https://www.ghxi.com/`, | ||||||||||
// 源文章 | ||||||||||
item: items, | ||||||||||
}; | ||||||||||
}, | ||||||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { Namespace } from '@/types'; | ||
|
||
export const namespace: Namespace = { | ||
name: '果核剥壳网-ghxi.com', | ||
url: 'www.ghxi.com', | ||
description: '果核剥壳新发帖子', | ||
}; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,51 @@ | ||||||
import { Route } from '@/types'; | ||||||
import ofetch from '@/utils/ofetch'; | ||||||
import { load } from 'cheerio'; | ||||||
|
||||||
export const route: Route = { | ||||||
path: '/limit', | ||||||
categories: ['traditional-media'], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
example: '/sohumobile/limit', | ||||||
parameters: {}, | ||||||
features: { | ||||||
requireConfig: false, | ||||||
requirePuppeteer: false, | ||||||
antiCrawler: true, | ||||||
supportBT: false, | ||||||
supportPodcast: false, | ||||||
supportScihub: false, | ||||||
}, | ||||||
radar: [ | ||||||
{ | ||||||
source: ['m.sohu.com/limit'], | ||||||
target: '/limit', | ||||||
}, | ||||||
], | ||||||
name: '手机搜狐网-新闻', | ||||||
maintainers: ['asqwe1'], | ||||||
handler: async () => { | ||||||
const response = await ofetch(`https://m.sohu.com/limit`); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Only use template literals when necessary. |
||||||
const $ = load(response); | ||||||
const items = $('.content-left section > div.f') | ||||||
// 使用“toArray()”方法将选择的所有 DOM 元素以数组的形式返回。 | ||||||
.toArray() | ||||||
// 使用“map()”方法遍历数组,并从每个元素中解析需要的数据。 | ||||||
.map((item) => { | ||||||
item = $(item); | ||||||
const a = item.find('a').first(); | ||||||
return { | ||||||
title: a.text(), | ||||||
link: String(a.attr('href')), | ||||||
}; | ||||||
}); | ||||||
Comment on lines
+29
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the embedded JSON |
||||||
// 在此处编写路由处理函数 | ||||||
return { | ||||||
// 源标题 | ||||||
title: `手机搜狐新闻`, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// 源链接 | ||||||
link: `https://m.sohu.com/limit`, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// 源文章 | ||||||
item: items, | ||||||
}; | ||||||
}, | ||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { Namespace } from '@/types'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The site does not have |
||
|
||
export const namespace: Namespace = { | ||
name: '手机搜狐网', | ||
url: 'm.sohu.com', | ||
description: '手机搜狐网的新闻抓取-RSS', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This site provides its RSS feed at https://www.52pojie.cn/forum.php?mod=rss&fid=16 which provides more information than this feed.