diff --git a/lib/v2/github/maintainer.js b/lib/v2/github/maintainer.js
index 6e0c2f26e..77acea474 100644
--- a/lib/v2/github/maintainer.js
+++ b/lib/v2/github/maintainer.js
@@ -11,7 +11,7 @@ module.exports = {
'/starred_repos/:user': ['LanceZhu'],
'/stars/:user/:repo': ['HenryQW'],
'/topics/:name/:qs?': ['queensferryme'],
- '/trending/:since/:language?/:spoken_language?': ['DIYgod', 'jameschensmith'],
+ '/trending/:since/:language/:spoken_language?': ['DIYgod', 'jameschensmith'],
'/user/followers/:user': ['HenryQW'],
'/wiki/:user/:repo/:page?': ['TonyRL'],
};
diff --git a/lib/v2/github/trending.js b/lib/v2/github/trending.js
index 62f3a5bef..33776864d 100644
--- a/lib/v2/github/trending.js
+++ b/lib/v2/github/trending.js
@@ -6,7 +6,7 @@ const path = require('path');
module.exports = async (ctx) => {
if (!config.github || !config.github.access_token) {
- throw 'GitHub trending RSS is disabled due to the lack of relevant config';
+ throw Error('GitHub trending RSS is disabled due to the lack of relevant config');
}
const since = ctx.params.since;
const language = ctx.params.language === 'any' ? '' : ctx.params.language;
@@ -23,15 +23,13 @@ module.exports = async (ctx) => {
const $ = cheerio.load(trendingPage);
const articles = $('article');
- const trendingRepos = articles
- .map((_, item) => {
- const [owner, name] = $(item).find('h1').text().split('/');
- return {
- name: name.trim(),
- owner: owner.trim(),
- };
- })
- .get();
+ const trendingRepos = articles.toArray().map((item) => {
+ const [owner, name] = $(item).find('h2').text().split('/');
+ return {
+ name: name.trim(),
+ owner: owner.trim(),
+ };
+ });
const { data: repoData } = await got({
method: 'post',