forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #654 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
17 changed files
with
230 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
// '/vul': ['qwertyuiop6'], | ||
'/:category': ['qwertyuiop6'], | ||
'/:category/:fulltext?': ['qwertyuiop6'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = (router) => { | ||
// router.get('/vul', require('./vul')); // 404 | ||
router.get('/:category', require('./category')); | ||
router.get('/:category/:fulltext?', require('./category')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/rss/:id?': ['TonyRL'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
'cnbc.com': { | ||
_name: 'CNBC', | ||
search: [ | ||
{ | ||
title: '全文 RSS', | ||
docs: 'https://docs.rsshub.app/traditional-media.html#cnbc', | ||
source: ['/rs/search/combinedcms/view.xml'], | ||
target: (_, url) => `/cnbc/rss/${new URL(url).searchParams.get('id')}`, | ||
}, | ||
], | ||
www: [ | ||
{ | ||
title: '全文 RSS', | ||
docs: 'https://docs.rsshub.app/traditional-media.html#cnbc', | ||
source: ['/id/:id/device/rss/rss.html'], | ||
target: '/cnbc/rss/:id', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/rss/:id?', require('./rss')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const parser = require('@/utils/rss-parser'); | ||
|
||
module.exports = async (ctx) => { | ||
const { id = '100003114' } = ctx.params; | ||
const feed = await parser.parseURL(`https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=${id}`); | ||
|
||
const items = await Promise.all( | ||
feed.items | ||
.filter((i) => !i.link.startsWith('https://www.cnbc.com/select/')) | ||
.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data: response } = await got(item.link); | ||
const $ = cheerio.load(response); | ||
|
||
delete item.content; | ||
delete item.contentSnippet; | ||
delete item.isoDate; | ||
|
||
item.description = ''; | ||
if ($('.RenderKeyPoints-keyPoints').length) { | ||
$('.RenderKeyPoints-keyPoints').html(); | ||
} | ||
if ($('.FeaturedContent-articleBody').length) { | ||
item.description += $('.FeaturedContent-articleBody').html(); | ||
} | ||
if ($('.ArticleBody-articleBody').length) { | ||
item.description += $('.ArticleBody-articleBody').html(); | ||
} | ||
if ($('.LiveBlogBody-articleBody').length) { | ||
item.description += $('.LiveBlogBody-articleBody').html(); | ||
} | ||
if ($('.ClipPlayer-clipPlayer').length) { | ||
item.description += $('.ClipPlayer-clipPlayer').html(); | ||
} | ||
|
||
const meta = JSON.parse($('[type=application/ld+json]').last().text()); | ||
item.author = meta.author ? (meta.author.name ? meta.author.name : meta.author.map((a) => a.name).join(', ')) : null; | ||
item.category = meta.keywords; | ||
|
||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: feed.title, | ||
link: feed.link, | ||
description: feed.description, | ||
item: items, | ||
language: feed.language, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
const baseUrl = 'https://kuwaitlocal.com'; | ||
|
||
module.exports = async (ctx) => { | ||
const { category = 'latest' } = ctx.params; | ||
const url = `${baseUrl}/news/${category === 'latest' ? category : `categories/${category}`}`; | ||
|
||
const { data: response } = await got(url); | ||
const $ = cheerio.load(response); | ||
const list = $('.news_list a') | ||
.toArray() | ||
.map((item) => { | ||
item = $(item); | ||
return { | ||
title: item.text(), | ||
link: baseUrl + item.attr('href'), | ||
}; | ||
}); | ||
|
||
const items = await Promise.all( | ||
list.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data: response } = await got(item.link); | ||
const $ = cheerio.load(response); | ||
|
||
item.pubDate = parseDate($('.date_icon').next().text()); | ||
$('[id^=div-gpt-ad], .pad_10_0, .hide_desktop').remove(); | ||
item.description = $('.mob_pad_view').html(); | ||
item.category = $('.news_tags a') | ||
.toArray() | ||
.map((item) => $(item).text()); | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: $('head title').text().trim(), | ||
description: $('head meta[name="description"]').attr('content').trim(), | ||
link: url, | ||
item: items, | ||
language: 'en', | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
'/': ['TonyRL'], | ||
'/:category?': ['TonyRL'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
'kuwaitlocal.com': { | ||
_name: 'Kuwait Local', | ||
'.': [ | ||
{ | ||
title: 'Latest News', | ||
docs: 'https://docs.rsshub.app/en/new-media.html#kuwait-local', | ||
source: ['/news/latest', '/news', '/'], | ||
target: '/kuwaitlocal', | ||
}, | ||
{ | ||
title: 'Categorised News', | ||
docs: 'https://docs.rsshub.app/en/new-media.html#kuwait-local', | ||
source: ['/news/categories/:category'], | ||
target: '/kuwaitlocal/:category', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/:category?', require('./index')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{ if description }} | ||
{{@ description }} | ||
{{ /if }} | ||
{{ if more }} | ||
{{@ more }} | ||
{{ /if }} | ||
{{ if images }} | ||
{{ each images image }} | ||
<img src="{{ image.uri }}" width="{{ image.width }}" height="{{ image.height }}"> | ||
{{ /each }} | ||
{{ /if }} |
5c591d1
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.
Successfully deployed to the following URLs:
rsshub – ./
rsshub-narcissu.vercel.app
rsshub-git-master-narcissu.vercel.app
rsshub.tari.xyz