mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): indiansinkuwait (#10855)
* feat(route): indiansinkuwait * docs: fix case
This commit is contained in:
@@ -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,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/latest': ['TonyRL'],
|
||||
};
|
||||
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/latest', require('./latest'));
|
||||
};
|
||||
Reference in New Issue
Block a user