Skip to content

Commit

Permalink
Merge pull request #32 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 24, 2023
2 parents b974ae1 + af1c20a commit 8affa4a
Show file tree
Hide file tree
Showing 28 changed files with 284 additions and 38 deletions.
3 changes: 3 additions & 0 deletions lib/v2/gogoanimehd/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/recent-releases': ['user4302'],
};
13 changes: 13 additions & 0 deletions lib/v2/gogoanimehd/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'gogoanimehd.io': {
_name: 'Gogoanime',
developer: [
{
title: 'Recent Releases',
docs: 'https://docs.rsshub.app/routes/anime#gogoanimehd',
source: ['/'],
target: '/gogoanimehd/recent-releases',
},
],
},
};
37 changes: 37 additions & 0 deletions lib/v2/gogoanimehd/recent-releases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const rootUrl = 'https://gogoanimehd.io';

const response = await got({
method: 'get',
url: rootUrl,
});

const $ = cheerio.load(response.data);
const recentReleases = $('.last_episodes');
const listItems = $(recentReleases).find('li');

const arrayOfItems = listItems.toArray().map((item) => {
const title = $(item).find('.name a').attr('title');
const episode = $(item).find('.episode').text();
const link = $(item).find('.name a').attr('href');
const img = $(item).find('.img a img').attr('src');

const formattedDescription = `<h2>${episode}</h2><br/><img src='${img}' alt='${title}'>`;

const structuredData = {
title,
description: formattedDescription,
link,
};
return structuredData;
});

ctx.state.data = {
title: $('title').text(),
link: rootUrl,
item: arrayOfItems,
};
};
3 changes: 3 additions & 0 deletions lib/v2/gogoanimehd/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/recent-releases', require('./recent-releases'));
};
68 changes: 68 additions & 0 deletions lib/v2/gov/chongqing/gzw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const { category = 'tzgg_191' } = ctx.params;
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 15;

const rootUrl = 'https://gzw.cq.gov.cn';
const currentUrl = new URL(category, rootUrl).href;

const { data: response } = await got(currentUrl);

const $ = cheerio.load(response);

let items = $('ul.tab-item li.clearfix')
.slice(0, limit)
.toArray()
.map((item) => {
item = $(item);

const a = item.find('a');

return {
title: a.text(),
link: new URL(a.prop('href').replace(/^\./, category), rootUrl).href,
pubDate: parseDate(item.find('span').text()),
};
});

items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: detailResponse } = await got(item.link);

const content = cheerio.load(detailResponse);

item.title = content('meta[name="ArticleTitle"]').prop('content');
item.description = content('div.trs_paper_default').html();
item.author = content('meta[name="ContentSource"]').prop('content');
item.category = content('meta[name="Keywords"]')
.prop('content')
.split(/;/)
.filter((c) => c);
item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').prop('content')), +8);

return item;
})
)
);

const icon = new URL('favicon.ico', rootUrl).href;

ctx.state.data = {
item: items,
title: `${$('title').text()} - ${$('meta[name="ColumnName"]').prop('content')}`,
link: currentUrl,
description: $('meta[name="ColumnDescription"]').prop('content'),
language: $('html').prop('lang'),
image: new URL($('div.logo img').prop('src'), rootUrl).href,
icon,
logo: icon,
subtitle: $('meta[name="ColumnKeywords"]').prop('content'),
author: $('meta[name="SiteName"]').prop('content'),
allowEmpty: true,
};
};
1 change: 1 addition & 0 deletions lib/v2/gov/maintainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = {
'/beijing/bphc/:channel': ['bigfei'],
'/beijing/jw/tzgg': ['nczitzk'],
'/beijing/kw/:channel': ['Fatpandac'],
'/chongqing/gzw/:category?': ['nczitzk'],
'/chongqing/rsks': ['Mai19930513'],
'/chongqing/sydwgkzp': ['MajexH'],
'/dianbai/:path+': ['ShuiHuo'],
Expand Down
12 changes: 12 additions & 0 deletions lib/v2/gov/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,18 @@ module.exports = {
target: '/gov/chongqing/sydwgkzp',
},
],
gzw: [
{
title: '国有资产监督管理委员会',
docs: 'https://docs.rsshub.app/routes/government#chong-qing-shi-ren-min-zheng-fu-guo-you-zi-chan-jian-du-guan-li-wei-yuan-hui',
source: ['/:category*'],
target: (params) => {
const category = params.category;

return `/gov/chongqing/gzw${category ? `/${category}` : ''}`;
},
},
],
},
'csrc.gov.cn': {
_name: '中国证券监督管理委员会',
Expand Down
1 change: 1 addition & 0 deletions lib/v2/gov/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = function (router) {
router.get(/beijing\/bphc(\/[\w/-]+)?/, require('./beijing/bphc'));
router.get('/beijing/jw/tzgg', require('./beijing/jw/tzgg'));
router.get('/beijing/kw/:channel', require('./beijing/kw/index'));
router.get('/chongqing/gzw/:category*', require('./chongqing/gzw'));
router.get('/chongqing/rsks', require('./chongqing/rsks'));
router.get('/chongqing/sydwgkzp', require('./chongqing/sydwgkzp'));
router.get(/dianbai(\/[\w/-]+)?/, require('./dianbai/dianbai'));
Expand Down
50 changes: 50 additions & 0 deletions lib/v2/hackyournews/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Require necessary modules
const got = require('@/utils/got'); // a customised got
const cheerio = require('cheerio'); // an HTML parser with a jQuery-like API
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const baseUrl = 'https://hackyournews.com';
const { data: response } = await got(baseUrl);
const $ = cheerio.load(response);

const item = $('tr.story')
.map((_, story) => {
const title = $(story).find('a').first().text();
const nextRow = $(story).next();
const metas = nextRow.text().trimStart().split('|');
const upvotes = parseInt(metas[0].split(' points')[0].trim());
const author = metas[0].split('by')[1].trim();
const pubDate = parseDate(metas[1].trim());
let category = [];
// NOTE: If the summary is not already proceeded, we cannot get the category.
if (metas.length === 5) {
category = [metas[2].trim(), metas[3].trim()];
}
const a = nextRow.find('a');
const link = a.attr('href');
const comments = parseInt(a.text());
const description = nextRow
.find('p')
.map((_, p) => $(p).text())
.get()
.join('<br>');
return {
title,
link,
author,
category,
comments,
upvotes,
pubDate,
description,
};
})
.get();

ctx.state.data = {
title: 'Index',
link: baseUrl,
item,
};
};
3 changes: 3 additions & 0 deletions lib/v2/hackyournews/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/': ['ftiasch'],
};
13 changes: 13 additions & 0 deletions lib/v2/hackyournews/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'hackyournews.com': {
_name: 'HackYourNews',
'.': [
{
title: 'Index',
docs: 'https://docs.rsshub.app/routes/programming#hack-your-news',
source: ['/'],
target: '/hackyournews',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/hackyournews/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/', require('./index'));
};
9 changes: 8 additions & 1 deletion lib/v2/radio-canada/latest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const language = ctx.params.language ?? 'en';
Expand Down Expand Up @@ -28,7 +29,13 @@ module.exports = async (ctx) => {
url: item.link,
});

item.description = detailResponse.data.match(/"body":{"html":"(.*)","attachments"/)[1].replace(/\\n/g, '');
const $ = cheerio.load(detailResponse.data);
const rcState = $('script:contains("window._rcState_ = JSON.parse")')
.text()
.match(/JSON\.parse\((".*")\);/)[1];
const rcStateJson = JSON.parse(JSON.parse(rcState));
const news = Object.values(rcStateJson.pagesV2.pages)[0];
item.description = news.data.newsStory.body.html.replace(/\\n/g, '<br>');

return item;
})
Expand Down
4 changes: 2 additions & 2 deletions website/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RSSHub can be used with browser extension [RSSHub Radar](https://github.com/DIYg
### Special Sponsors

<p>
<a href="https://xlog.app/" target="_blank"><img style={{height: "100px"}} src="https://i.imgur.com/JuhHTKD.png" /></a>
<Link to="https://xlog.app/"><img style={{height: "100px"}} src="https://i.imgur.com/JuhHTKD.png" /></Link>
</p>

[![](https://opencollective.com/static/images/become_sponsor.svg)](https://docs.rsshub.app/support/)
Expand All @@ -41,7 +41,7 @@ Logo designer [sheldonrrr](https://dribbble.com/sheldonrrr)

### Backers

<a href="https://www.cloudflare.com" target="_blank"><img style={{height: "50px"}} src="https://i.imgur.com/7Ph27Fq.png" /></a><a href="https://www.netlify.com" target="_blank" style={{marginLeft: "60px"}}><img style={{height: "40px"}} src="https://i.imgur.com/cU01915.png" /></a>
<Link to="https://www.cloudflare.com"><img style={{height: "50px"}} src="https://i.imgur.com/7Ph27Fq.png" /></Link><Link to="https://www.netlify.com" style={{marginLeft: "60px"}}><img style={{height: "40px"}} src="https://i.imgur.com/cU01915.png" /></Link>

## Related Projects

Expand Down
4 changes: 3 additions & 1 deletion website/docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# FAQs

import Translate from '@docusaurus/Translate';

**Q: How does RSSHub work?**

**A:** When a request is received, RSSHub fetches the corresponding data from the original site, the resulting contents will be outputted in RSS format. Caching is implemented to avoid requesting original sites for content. And of course, we throw in a little magic 🎩.

**Q: Can I use the demo instance?**

**A:** [rsshub.app](https://rsshub.app) is the demo instance provided, running the latest build of RSSHub from master branch, the cache is set 120 minutes and it's free to use. However, if you see an badge <Badge text="strict anti-crawler policy" vertical="middle" type="warn"/> for route, this means popular websites such as Facebook etc. may pose a request quota on individual IP address, which means it can get unreliable from time to time for the demo instance. You are encouraged to [host your own RSSHub instance](/install/) to get a better usability.
**A:** [rsshub.app](https://rsshub.app) is the demo instance provided, running the latest build of RSSHub from master branch, the cache is set 120 minutes and it's free to use. However, if you see an badge <Badge vertical="middle" type="warn"><Translate id="badge.anticrawler" /></Badge> for route, this means popular websites such as Facebook etc. may pose a request quota on individual IP address, which means it can get unreliable from time to time for the demo instance. You are encouraged to [host your own RSSHub instance](/install/) to get a better usability.

**Q: Why are images/videos not loading in some RSSHub routes?**

Expand Down
2 changes: 1 addition & 1 deletion website/docs/joinus/new-rss/add-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 4

# Add documentation

Now that we have completed the code, it's time to add the documentation for your route. Open the appropriate file in the [document (/website/docs)](https://github.com/DIYgod/RSSHub/blob/master/website/docs), which in this example is `/website/i18n/en/docusaurus-plugin-content-docs/current/routes/programming.md`.
Now that we have completed the code, it's time to add the documentation for your route. Open the appropriate file in the [document (/website/docs)](https://github.com/DIYgod/RSSHub/blob/master/website/docs), which in this example is `website/docs/routes/programming.md`.

In order to preview the documentation in real-time, you need to install the dependencies for the documentation. Run the following command in the **`website` directory**:

Expand Down
8 changes: 4 additions & 4 deletions website/docs/joinus/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Once you have installed RSSHub Radar, open the settings and switch to the "List

[Let's start!](/joinus/new-radar)

<a href="https://chrome.google.com/webstore/detail/rsshub-radar/kefjpfngnndepjbopdmoebkipbgkggaa" target="_blank" rel="noopener noreferrer"><img src="https://storage.googleapis.com/web-dev-uploads/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/UV4C4ybeBTsZt43U4xis.png" alt="Get RSSHub Radar for Chromium" style={{height: "58px"}} /></a>
<a href="https://addons.mozilla.org/firefox/addon/rsshub-radar/" target="_blank" rel="noopener noreferrer"><img src="https://blog.mozilla.org/addons/files/2020/04/get-the-addon-fx-apr-2020.svg" alt="Get Get RSSHub Radar for Firefox" style={{height: "58px"}} /></a>
<a href="https://microsoftedge.microsoft.com/addons/detail/rsshub-radar/gangkeiaobmjcjokiofpkfpcobpbmnln" target="_blank" rel="noopener noreferrer"><img src="https://wsrv.nl/?url=https://upload.wikimedia.org/wikipedia/commons/f/f7/Get_it_from_Microsoft_Badge.svg" alt="Get RSSHub Radar for Edge" style={{height: "58px"}} /></a>
<a href="https://apps.apple.com/us/app/rsshub-radar/id1610744717" target="_blank" rel="noopener noreferrer"><img src="https://developer.apple.com/news/images/download-on-the-app-store-badge.png" alt="Get RSSHub Radar for Safari" style={{height: "58px"}} /></a>
<Link to="https://chrome.google.com/webstore/detail/rsshub-radar/kefjpfngnndepjbopdmoebkipbgkggaa" target="_blank" rel="noopener noreferrer"><img src="https://storage.googleapis.com/web-dev-uploads/image/WlD8wC6g8khYWPJUsQceQkhXSlv1/UV4C4ybeBTsZt43U4xis.png" alt="Get RSSHub Radar for Chromium" style={{height: "58px"}} /></Link>
<Link to="https://addons.mozilla.org/firefox/addon/rsshub-radar/" target="_blank" rel="noopener noreferrer"><img src="https://blog.mozilla.org/addons/files/2020/04/get-the-addon-fx-apr-2020.svg" alt="Get Get RSSHub Radar for Firefox" style={{height: "58px"}} /></Link>
<Link to="https://microsoftedge.microsoft.com/addons/detail/rsshub-radar/gangkeiaobmjcjokiofpkfpcobpbmnln" target="_blank" rel="noopener noreferrer"><img src="https://wsrv.nl/?url=https://upload.wikimedia.org/wikipedia/commons/f/f7/Get_it_from_Microsoft_Badge.svg" alt="Get RSSHub Radar for Edge" style={{height: "58px"}} /></Link>
<Link to="https://apps.apple.com/us/app/rsshub-radar/id1610744717" target="_blank" rel="noopener noreferrer"><img src="https://developer.apple.com/news/images/download-on-the-app-store-badge.png" alt="Get RSSHub Radar for Safari" style={{height: "58px"}} /></Link>
8 changes: 4 additions & 4 deletions website/docs/parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

Parameters here are actually URI query and can be linked together with `&` to generate a complex feed.

Parameters here need to be placed after the route path. Some routes may have <span style={{color: "green"}}>**custom route parameters**</span> and <span style={{color: "violet"}}>**parameters here**</span> need to be placed after them.
Parameters here need to be placed after the route path. Some routes may have <b><span style={{color: "green"}}>custom route parameters</span></b> and <b><span style={{color: "violet"}}>parameters here</span></b> need to be placed after them.

E.g.

<a href="https://rsshub.app/twitter/user/durov/readable=1&includeRts=0?brief=100&limit=5">https://rsshub.app/twitter/user/durov/<span style={{color: "green"}}><b>readable=1&includeRts=0</b></span>?<span style={{color: "violet"}}><b>brief=100&limit=5</b></span></a>
<Link to="https://rsshub.app/twitter/user/durov/readable=1&includeRts=0?brief=100&limit=5">https://rsshub.app/twitter/user/durov/<span style={{color: "green"}}><b>readable=1&includeRts=0</b></span>?<span style={{color: "violet"}}><b>brief=100&limit=5</b></span></Link>

If a <span style={{color: "magenta"}}>**output format**</span> (`.atom`, `.rss`, `.json`, `.debug.json`) is set, it needs to be placed between the route path (including <span style={{color: "green"}}>**custom route parameters**</span>) and <span style={{color: "violet"}}>**other parameters**</span>.
If a <b><span style={{color: "magenta"}}>output format</span></b> (`.atom`, `.rss`, `.json`, `.debug.json`) is set, it needs to be placed between the route path (including <b><span style={{color: "green"}}>custom route parameters</span></b>) and <b><span style={{color: "violet"}}>other parameters</span></b>.

E.g.

<a href="https://rsshub.app/twitter/user/durov/readable=1&includeRts=0.atom?brief=100&limit=5">https://rsshub.app/twitter/user/durov/<span style={{color: "green"}}><b>readable=1&includeRts=0</b></span><span style={{color: "magenta"}}><b>.atom</b></span>?<span style={{color: "violet"}}><b>brief=100&limit=5</b></span></a>
<Link to="https://rsshub.app/twitter/user/durov/readable=1&includeRts=0.atom?brief=100&limit=5">https://rsshub.app/twitter/user/durov/<span style={{color: "green"}}><b>readable=1&includeRts=0</b></span><span style={{color: "magenta"}}><b>.atom</b></span>?<span style={{color: "violet"}}><b>brief=100&limit=5</b></span></Link>

:::

Expand Down
8 changes: 7 additions & 1 deletion website/docs/routes/anime.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ If you subscribe to [Discounted works Latest Discounts - Newest to Oldest](https

<Route author="KTachibanaM" path="/eventernote/actors/:name/:id" example="/eventernote/actors/三森すずこ/2634" paramsDesc={['声优姓名', '声优 ID']} radar="1" rssbud="1"/>

## Gogoanimehd {#gogoanimehd}

### Recent Releases {#gogoanimehd-recent-releases}

<Route author="user4302" example="/gogoanimehd/recent-releases" path="/gogoanimehd/recent-releases" />


## Hanime.tv {#hanime.tv}

### Recently updated {#hanime.tv-recently-updated}
Expand Down Expand Up @@ -904,4 +911,3 @@ You can use some RSS parsing libraries (like `feedpraser` in `Python`) to receiv
### 當季新番 {#%E3%82%A2%E3%83%8B%E3%83%A1-xin-fan-zu-dang-ji-xin-fan}

<Route author="devinmugen" example="/bangumi/online" path="/bangumi/online"/>

10 changes: 10 additions & 0 deletions website/docs/routes/government.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ Language

## 重庆市人民政府 {#chong-qing-shi-ren-min-zheng-fu}

### 国有资产监督管理委员会 {#chong-qing-shi-ren-min-zheng-fu-guo-you-zi-chan-jian-du-guan-li-wei-yuan-hui}

<Route author="nczitzk" example="/gov/chongqing/gzw" path="/gov/chongqing/gzw/:category?" paramsDesc={['分类,见下表,默认为通知公告']} radar="1" rssbud="1">

| 通知公告 | 国企资讯 | 国企简介 | 国企招聘 |
| -------- | -------- | -------- | -------- |
| tzgg_191 | gqdj | gqjj | gqzp |

</Route>

### 两江新区信息公开网 {#chong-qing-shi-ren-min-zheng-fu-liang-jiang-xin-qu-xin-xi-gong-kai-wang}

#### 党务公开 {#chong-qing-shi-ren-min-zheng-fu-liang-jiang-xin-qu-xin-xi-gong-kai-wang-dang-wu-gong-kai}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/routes/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ For example:
1. If we want to search software engineer jobs of all levels and all job types, use `/linkedin/jobs/all/all/software engineer`
2. If we want to search all entry level contractor/part time software engineer jobs, use `/linkedin/jobs/P-C/2/software engineer`

**To make it easier, the recommended way is to start a search on <a href="https://www.linkedin.com/jobs/search">LinkedIn</a> and use <a href="https://github.com/DIYgod/RSSHub-Radar">RSSHub Radar</a> to load the specific feed.**
**To make it easier, the recommended way is to start a search on [LinkedIn](https://www.linkedin.com/jobs/search) and use [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) to load the specific feed.**

</Route>

Expand Down
7 changes: 7 additions & 0 deletions website/docs/routes/programming.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ Subscribe to the updates (threads and submission) from a paritcular Hacker News

<Route author="Yukaii kaiix" example="/hackmd/profile/hackmd" path="/hackmd/profile/:path" paramsDesc={['userpath or teampath']} radar="1"/>


## HackYourNews {#hackyournews}

### Index {#hackyournews-index}

<Route author="ftiasch" example="/hackyournews" path="/hackyournews" />

## HelloGitHub {#hellogithub}

### 热门 {#hellogithub-re-men}
Expand Down
Loading

0 comments on commit 8affa4a

Please sign in to comment.