feat(route): indiansinkuwait (#10855)

* feat(route): indiansinkuwait

* docs: fix case
This commit is contained in:
Tony 2022-09-21 19:03:33 +02:00 committed by GitHub
parent 7c10412b65
commit eaf72004a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 69 additions and 1 deletions

View File

@ -382,6 +382,12 @@ Provides a better reading experience (full text articles) over the official one.
</RouteEn>
## Indians in Kuwait
### News
<RouteEn author="TonyRL" example="/indiansinkuwait/latest" path="/indiansinkuwait/latest" radar="1" rssbud="1"/>
## Institute of International Education
### Blog

View File

@ -1413,7 +1413,7 @@ Supported sub-sites:
</Route>
## web3caff
## Web3Caff
### 发现

View File

@ -0,0 +1,43 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const baseUrl = 'https://www.indiansinkuwait.com';
module.exports = async (ctx) => {
const { data: response } = await got(`${baseUrl}/latest-news`);
const $ = cheerio.load(response);
const list = $('.paragraphs .span4')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('.content-heading h6 a').text().trim(),
link: baseUrl + item.find('a').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($('#ctl00_ContentPlaceHolder1_SpanAuthor').text());
$('#newsdetails h3, #ctl00_ContentPlaceHolder1_SpanAuthor, .noprint, [id^=div-gpt-ad]').remove();
item.description = $('#newsdetails').html();
return item;
})
)
);
ctx.state.data = {
title: $('head title').text(),
description: $('head meta[name="description"]').attr('content'),
image: 'https://www.indiansinkuwait.com/apple-touch-icon-152x152-precomposed.png',
link: `${baseUrl}/latest-news`,
item: items,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/latest': ['TonyRL'],
};

View File

@ -0,0 +1,13 @@
module.exports = {
'indiansinkuwait.com': {
_name: 'Indians in Kuwait',
'.': [
{
title: 'News',
docs: 'https://docs.rsshub.app/en/new-media.html#indians-in-kuwait',
source: ['/latest-news', '/'],
target: '/indiansinkuwait/latest',
},
],
},
};

View File

@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/latest', require('./latest'));
};