Skip to content

Commit

Permalink
Merge pull request #659 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Sep 29, 2022
2 parents 9096fec + 1fd2a8f commit 63c67c2
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 336 deletions.
2 changes: 1 addition & 1 deletion assets/radar-rules.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
({
'8world.com': { _name: '8视界', '.': [{ title: '分类', docs: 'https://docs.rsshub.app/new-media.html#_8-shi-jie-fen-lei', source: ['/:category', '/'], target: '/8world/:category?' }] },
// '8world.com': { _name: '8视界', '.': [{ title: '分类', docs: 'https://docs.rsshub.app/new-media.html#_8-shi-jie-fen-lei', source: ['/:category', '/'], target: '/8world/:category?' }] },
'aamacau.com': { _name: '論盡媒體 AllAboutMacau Media', '.': [{ title: '话题', docs: 'https://docs.rsshub.app/new-media.html#lun-jin-mei-ti-allaboutmacau-media-hua-ti', source: ['/'], target: '/:category?/:id?' }] },
'eprice.com.tw': { _name: 'ePrice', '.': [{ title: 'ePrice 比價王', docs: 'https://docs.rsshub.app/new-media.html#eprice', source: ['/'], target: '/:region?' }] },
'eprice.com.hk': { _name: 'ePrice', '.': [{ title: 'ePrice 香港', docs: 'https://docs.rsshub.app/new-media.html#eprice', source: ['/'], target: '/:region?' }] },
Expand Down
19 changes: 15 additions & 4 deletions docs/new-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,25 @@ pageClass: routes

### 分类

<Route author="nczitzk" example="/8world" path="/8world/:category?" :paramsDesc="['分类,见下表,默认为即时']">
<Route author="nczitzk" example="/8world" path="/8world/:category?" :paramsDesc="['分类 id,见下表,默认为即时 REALTIME']">

| 即时 | 新加坡 | 东南亚 | 中港台 | 国际 | 财经 | 体育 |
| -------- | --------- | -------------- | ------------- | ----- | ------- | ------ |
| realtime | singapore | southeast-asia | greater-china | world | finance | sports |
| 分类 | id |
| ------------------- | -------------- |
| 即时 REALTIME | realtime |
| 新加坡 SINGAPORE | singapore |
| 东南亚 SOUTH-EAST ASIA | southeast-asia |
| 中港台 GREATER CHINA | greater-china |
| 国际 WORLD | world |
| 财经 FINANCE | finance |
| 体育 SPORTS | sports |
| 社团 COMMUNITY | community |

</Route>

### 标签

<Route author="nczitzk" example="/8world/topic/xianggang-3" path="/8world/topic/:id" :paramsDesc="['标签 id,可在对应标签页中找到']" />

## 9To5

### 9To5 分站
Expand Down
16 changes: 8 additions & 8 deletions lib/v2/8world/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const category = ctx.params.category ?? 'realtime';
const path = ctx.path === '/' ? '/realtime' : ctx.path;

const rootUrl = 'https://www.8world.com';
const currentUrl = `${rootUrl}/${category}`;
const currentUrl = `${rootUrl}${path}`;

const response = await got({
method: 'get',
Expand All @@ -15,19 +15,19 @@ module.exports = async (ctx) => {

const $ = cheerio.load(response.data);

const list = $('div[data-column="Two-Third"] .article-title .article-link')
.map((_, item) => {
let items = $('div[data-column="Two-Third"] .article-title .article-link')
.toArray()
.map((item) => {
item = $(item);

return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
};
})
.get();
});

const items = await Promise.all(
list.map((item) =>
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
Expand Down
1 change: 1 addition & 0 deletions lib/v2/8world/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
'/:category?': ['nczitzk'],
'/topic/:id': ['nczitzk'],
};
6 changes: 6 additions & 0 deletions lib/v2/8world/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ module.exports = {
source: ['/:category', '/'],
target: '/8world/:category?',
},
{
title: '标签',
docs: 'https://docs.rsshub.app/new-media.html#_8-shi-jie-biao-qian',
source: ['/topic/:id', '/'],
target: '/8world/topic/:id',
},
],
},
};
2 changes: 1 addition & 1 deletion lib/v2/8world/router.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = function (router) {
router.get('/:category?', require('./index'));
router.get(/([\w-/]+)?/, require('./index'));
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-yml": "1.2.0",
"fs-extra": "10.1.0",
"jest": "29.0.3",
"jest": "29.1.1",
"meilisearch": "0.27.0",
"mockdate": "3.0.5",
"nock": "13.2.9",
Expand Down Expand Up @@ -83,7 +83,7 @@
"dependencies": {
"@koa/router": "12.0.0",
"@postlight/parser": "2.2.2",
"@sentry/node": "7.13.0",
"@sentry/node": "7.14.0",
"aes-js": "3.1.2",
"art-template": "4.13.2",
"bbcodejs": "0.0.4",
Expand Down
Loading

1 comment on commit 63c67c2

@vercel
Copy link

@vercel vercel bot commented on 63c67c2 Sep 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

rsshub – ./

rsshub-git-master-narcissu.vercel.app
rsshub-narcissu.vercel.app
rsshub.tari.xyz

Please sign in to comment.