rsshub 1.0.0-master.f2c8f0c → 1.0.0-master.f2eee10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/lib/router.js +4 -3
  2. package/lib/utils/wechat-mp.js +1 -1
  3. package/lib/v2/2048/index.js +7 -5
  4. package/lib/v2/agirls/index.js +14 -42
  5. package/lib/v2/agirls/topic.js +16 -43
  6. package/lib/v2/agirls/topic_list.js +14 -14
  7. package/lib/v2/agirls/utils.js +37 -0
  8. package/lib/v2/apnews/topics.js +24 -30
  9. package/lib/v2/baozimh/index.js +9 -14
  10. package/lib/v2/bilibili/followers.js +12 -1
  11. package/lib/v2/bilibili/followings.js +16 -1
  12. package/lib/v2/bilibili/liveSearch.js +18 -10
  13. package/lib/v2/bilibili/maintainer.js +2 -2
  14. package/lib/v2/bilibili/router.js +2 -2
  15. package/lib/v2/blizzard/maintainer.js +3 -0
  16. package/lib/{routes → v2}/blizzard/news.js +14 -15
  17. package/lib/v2/blizzard/radar.js +13 -0
  18. package/lib/v2/blizzard/router.js +3 -0
  19. package/lib/v2/caixin/latest.js +5 -5
  20. package/lib/v2/copymanga/comic.js +74 -58
  21. package/lib/v2/copymanga/templates/comic.art +1 -1
  22. package/lib/v2/dhu/maintainer.js +1 -0
  23. package/lib/v2/dhu/news/xsxx.js +42 -0
  24. package/lib/v2/dhu/radar.js +8 -0
  25. package/lib/v2/dhu/router.js +1 -0
  26. package/lib/v2/globallawreview/index.js +55 -0
  27. package/lib/v2/globallawreview/maintainer.js +3 -0
  28. package/lib/v2/globallawreview/radar.js +13 -0
  29. package/lib/v2/globallawreview/router.js +3 -0
  30. package/lib/v2/gov/cac/index.js +4 -4
  31. package/lib/v2/gov/maintainer.js +1 -0
  32. package/lib/v2/gov/nifdc/index.js +2 -17
  33. package/lib/v2/gov/nmpa/generic.js +5 -27
  34. package/lib/v2/gov/nrta/dsj.js +59 -0
  35. package/lib/v2/gov/radar.js +13 -0
  36. package/lib/v2/gov/router.js +1 -0
  37. package/lib/v2/huoxian/maintainer.js +3 -0
  38. package/lib/v2/huoxian/radar.js +11 -0
  39. package/lib/v2/huoxian/router.js +3 -0
  40. package/lib/v2/huoxian/zone.js +19 -0
  41. package/lib/v2/javdb/utils.js +5 -4
  42. package/lib/v2/jike/radar.js +20 -0
  43. package/lib/v2/keylol/index.js +82 -0
  44. package/lib/v2/keylol/maintainer.js +3 -0
  45. package/lib/v2/keylol/radar.js +18 -0
  46. package/lib/v2/keylol/router.js +3 -0
  47. package/lib/v2/line/utils.js +18 -2
  48. package/lib/v2/macupdate/app.js +43 -0
  49. package/lib/v2/macupdate/maintainer.js +3 -0
  50. package/lib/v2/macupdate/radar.js +13 -0
  51. package/lib/v2/macupdate/router.js +3 -0
  52. package/lib/v2/radiofrance/templates/article.art +3 -1
  53. package/lib/v2/sec-in/index.js +19 -0
  54. package/lib/v2/sec-in/maintainer.js +3 -0
  55. package/lib/v2/sec-in/radar.js +11 -0
  56. package/lib/v2/sec-in/router.js +3 -0
  57. package/lib/v2/sec-wiki/maintainer.js +3 -0
  58. package/lib/v2/sec-wiki/radar.js +11 -0
  59. package/lib/v2/sec-wiki/router.js +3 -0
  60. package/lib/v2/sec-wiki/weekly.js +16 -0
  61. package/lib/v2/shu/index.js +48 -0
  62. package/lib/v2/shu/jwb.js +45 -0
  63. package/lib/v2/shu/maintainer.js +4 -0
  64. package/lib/v2/shu/radar.js +21 -0
  65. package/lib/v2/shu/router.js +5 -0
  66. package/lib/v2/stheadline/std/realtime.js +1 -1
  67. package/lib/v2/wikinews/index.js +28 -29
  68. package/lib/v2/wxkol/show.js +5 -34
  69. package/lib/v2/yangtzeu/dongke.js +60 -0
  70. package/lib/v2/yangtzeu/maintainer.js +3 -0
  71. package/lib/v2/yangtzeu/radar.js +18 -0
  72. package/lib/v2/yangtzeu/router.js +3 -0
  73. package/lib/v2/zaobao/util.js +38 -31
  74. package/package.json +3 -3
  75. package/lib/routes/universities/shu/index.js +0 -75
  76. package/lib/routes/universities/shu/jwc.js +0 -62
  77. package/lib/v2/agirls/templates/description.art +0 -1
package/lib/router.js CHANGED
@@ -744,8 +744,9 @@ router.get('/zjut/:type', lazyloadRouteHandler('./routes/universities/zjut/index
744
744
  router.get('/zjut/design/:type', lazyloadRouteHandler('./routes/universities/zjut/design'));
745
745
 
746
746
  // 上海大学
747
- router.get('/shu/:type?', lazyloadRouteHandler('./routes/universities/shu/index'));
748
- router.get('/shu/jwc/:type?', lazyloadRouteHandler('./routes/universities/shu/jwc'));
747
+ // router.get('/shu/:type?', lazyloadRouteHandler('./routes/universities/shu/index'));
748
+ // router.get('/shu/jwc/:type?', lazyloadRouteHandler('./routes/universities/shu/jwc'));
749
+ // router.get('/shu/jwb/:type?', lazyloadRouteHandler('./routes/universities/shu/jwc'));
749
750
 
750
751
  // 北京科技大学天津学院
751
752
  // router.get('/ustb/tj/news/:type?', lazyloadRouteHandler('./routes/universities/ustb/tj/news'));
@@ -3408,7 +3409,7 @@ router.get('/rescuetime/release-notes/:os?', lazyloadRouteHandler('./routes/resc
3408
3409
  router.get('/totalcommander/whatsnew', lazyloadRouteHandler('./routes/totalcommander/whatsnew'));
3409
3410
 
3410
3411
  // Blizzard
3411
- router.get('/blizzard/news/:language?/:category?', lazyloadRouteHandler('./routes/blizzard/news'));
3412
+ // router.get('/blizzard/news/:language?/:category?', lazyloadRouteHandler('./routes/blizzard/news'));
3412
3413
 
3413
3414
  // DeepMind
3414
3415
  // router.get('/deepmind/blog/:category?', lazyloadRouteHandler('./routes/deepmind/blog'));
@@ -213,7 +213,7 @@ const fetchArticle = (ctx, url, bypassHostCheck = false) => {
213
213
  }
214
214
 
215
215
  let pubDate;
216
- const publish_time_script = $('script[nonce][type="text/javascript"]:contains("var ct")').first().html();
216
+ const publish_time_script = $('script[nonce][type="text/javascript"]:contains("var ct")').text();
217
217
  const publish_time_match = publish_time_script && publish_time_script.match(/var ct *= *"?(\d{10})"?/);
218
218
  const publish_timestamp = publish_time_match && publish_time_match[1];
219
219
  if (publish_timestamp) {
@@ -17,6 +17,7 @@ module.exports = async (ctx) => {
17
17
  });
18
18
 
19
19
  const $ = cheerio.load(response.data);
20
+ const currentHost = `https://${new URL(response.url).host}`; // redirected host
20
21
 
21
22
  $('#shortcut').remove();
22
23
  $('tr[onmouseover="this.className=\'tr3 t_two\'"]').remove();
@@ -24,19 +25,20 @@ module.exports = async (ctx) => {
24
25
  const list = $('#ajaxtable tbody .tr2')
25
26
  .last()
26
27
  .nextAll('.tr3')
27
- .map((_, item) => {
28
+ .toArray()
29
+ .map((item) => {
28
30
  item = $(item).find('.subject');
29
31
 
30
32
  return {
31
33
  title: item.text(),
32
- link: `${rootUrl}/2048/${item.attr('href')}`,
34
+ link: `${currentHost}/2048/${item.attr('href')}`,
35
+ guid: `${rootUrl}/2048/${item.attr('href')}`,
33
36
  };
34
- })
35
- .get();
37
+ });
36
38
 
37
39
  const items = await Promise.all(
38
40
  list.map((item) =>
39
- ctx.cache.tryGet(item.link, async () => {
41
+ ctx.cache.tryGet(item.guid, async () => {
40
42
  const detailResponse = await got({
41
43
  method: 'get',
42
44
  url: item.link,
@@ -1,19 +1,15 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
- const { parseDate } = require('@/utils/parse-date');
4
- const timezone = require('@/utils/timezone');
5
- const path = require('path');
6
- const { art } = require('@/utils/render');
7
3
  const { CookieJar } = require('tough-cookie');
8
-
9
- const cookieJar = new CookieJar();
4
+ const { baseUrl, parseArticle } = require('./utils');
10
5
 
11
6
  module.exports = async (ctx) => {
12
- const baseUrl = 'https://agirls.aotter.net';
13
- const category = ctx.params.category ?? '';
7
+ const cookieJar = new CookieJar();
8
+ const { category = '' } = ctx.params;
9
+ const link = `${baseUrl}/posts${category ? `/${category}` : ''}`;
14
10
 
15
11
  const response = await got({
16
- url: baseUrl + '/posts' + (category ? `/${category}` : ''),
12
+ url: link,
17
13
  headers: {
18
14
  Referer: baseUrl,
19
15
  },
@@ -22,45 +18,21 @@ module.exports = async (ctx) => {
22
18
 
23
19
  const $ = cheerio.load(response.data);
24
20
 
25
- let items = $('div a.flex.flex-col')
26
- .map((_, item) => {
21
+ let items = $('.ag-post-item__link')
22
+ .toArray()
23
+ .map((item) => {
27
24
  item = $(item);
28
25
  return {
29
- title: item.find('h2').text().trim(),
30
- link: baseUrl + item.attr('href'),
26
+ title: item.text().trim(),
27
+ link: `${baseUrl}${item.attr('href')}`,
31
28
  };
32
- })
33
- .get();
34
-
35
- items = await Promise.all(
36
- items.map((item) =>
37
- ctx.cache.tryGet(item.link, async () => {
38
- const detailResponse = await got({
39
- url: item.link,
40
- headers: {
41
- Referer: baseUrl + '/posts/' + (category ? `/${category}` : ''),
42
- },
43
- cookieJar,
44
- });
45
- const content = cheerio.load(detailResponse.data);
46
-
47
- item.category = content('a.mr-2.bg-neutral-lightest.px-2.py-1.text-sm.text-neutral-light')
48
- .toArray()
49
- .map((e) => content(e).text().trim().replace('#', ''));
50
- item.description = art(path.join(__dirname, 'templates/description.art'), {
51
- desc: content('div.post-content').html(),
52
- });
53
- item.pubDate = timezone(parseDate(content('time').text().trim()), +8);
54
- item.author = content('a.mr-1.text-primary').text().trim();
29
+ });
55
30
 
56
- return item;
57
- })
58
- )
59
- );
31
+ items = await Promise.all(items.map((item) => ctx.cache.tryGet(item.link, () => parseArticle(item, link, cookieJar))));
60
32
 
61
33
  ctx.state.data = {
62
34
  title: $('head title').text().trim(),
63
- link: baseUrl + '/' + category,
35
+ link,
64
36
  description: $('head meta[name=description]').attr('content'),
65
37
  item: items,
66
38
  language: $('html').attr('lang'),
@@ -68,7 +40,7 @@ module.exports = async (ctx) => {
68
40
 
69
41
  ctx.state.json = {
70
42
  title: $('head title').text().trim(),
71
- link: baseUrl + '/' + category,
43
+ link,
72
44
  description: $('head meta[name=description]').attr('content'),
73
45
  item: items,
74
46
  language: $('html').attr('lang'),
@@ -1,70 +1,43 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
- const { parseDate } = require('@/utils/parse-date');
4
- const timezone = require('@/utils/timezone');
5
- const path = require('path');
6
- const { art } = require('@/utils/render');
3
+ const { baseUrl, parseArticle } = require('./utils');
7
4
 
8
5
  module.exports = async (ctx) => {
9
- const baseUrl = 'https://agirls.aotter.net';
10
- const topic = ctx.params.topic;
11
-
6
+ const { topic } = ctx.params;
7
+ const link = `${baseUrl}/topic/${topic}`;
12
8
  const response = await got({
13
- url: baseUrl + '/topic/' + topic,
9
+ url: link,
14
10
  headers: {
15
11
  Referer: baseUrl,
16
12
  },
17
13
  });
18
14
 
19
15
  const $ = cheerio.load(response.data);
20
-
21
- let items = $('div.col-12 div.row a')
22
- .map((_, item) => {
16
+ const ldJson = JSON.parse($('script[type="application/ld+json"]').text());
17
+ let items = $('.ag-post-item__link')
18
+ .toArray()
19
+ .map((item) => {
23
20
  item = $(item);
24
21
  return {
25
- title: item.find('h3').text().trim(),
26
- link: baseUrl + item.attr('href'),
22
+ title: item.text().trim(),
23
+ link: `${baseUrl}${item.attr('href')}`,
27
24
  };
28
- })
29
- .get();
30
-
31
- items = await Promise.all(
32
- items.map((item) =>
33
- ctx.cache.tryGet(item.link, async () => {
34
- const detailResponse = await got({
35
- url: item.link,
36
- headers: {
37
- Referer: baseUrl + '/topic/' + topic,
38
- },
39
- });
40
- const content = cheerio.load(detailResponse.data);
41
-
42
- item.category = content('a.mr-2.bg-neutral-lightest.px-2.py-1.text-sm.text-neutral-light')
43
- .toArray()
44
- .map((e) => content(e).text().trim().replace('#', ''));
45
- item.description = art(path.join(__dirname, 'templates/description.art'), {
46
- desc: content('div.post-content').html(),
47
- });
48
- item.pubDate = timezone(parseDate(content('time').text().trim()), +8);
49
- item.author = content('a.mr-1.text-primary').text().trim();
25
+ });
50
26
 
51
- return item;
52
- })
53
- )
54
- );
27
+ items = await Promise.all(items.map((item) => ctx.cache.tryGet(item.link, () => parseArticle(item, link, undefined))));
55
28
 
56
29
  ctx.state.data = {
57
30
  title: $('head title').text().trim(),
58
- link: baseUrl + '/' + topic,
59
- description: $('head meta[name=description]').attr('content'),
31
+ link,
32
+ description: ldJson['@graph'][0].description,
60
33
  item: items,
61
34
  language: $('html').attr('lang'),
62
35
  };
63
36
 
64
37
  ctx.state.json = {
65
38
  title: $('head title').text().trim(),
66
- link: baseUrl + '/' + topic,
67
- description: $('head meta[name=description]').attr('content'),
39
+ link,
40
+ description: ldJson['@graph'][0].description,
68
41
  item: items,
69
42
  language: $('html').attr('lang'),
70
43
  };
@@ -1,12 +1,13 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
+ const { baseUrl } = require('./utils');
3
4
 
4
5
  module.exports = async (ctx) => {
5
- const baseUrl = 'https://agirls.aotter.net';
6
6
  const category = 'topic';
7
+ const link = `${baseUrl}/${category}`;
7
8
 
8
9
  const response = await got({
9
- url: baseUrl + '/' + category,
10
+ url: `${baseUrl}/${category}`,
10
11
  headers: {
11
12
  Referer: baseUrl,
12
13
  },
@@ -14,21 +15,20 @@ module.exports = async (ctx) => {
14
15
 
15
16
  const $ = cheerio.load(response.data);
16
17
 
17
- const items = $('div div.border-b.border-neutral-lighter')
18
- .map((_, item) => {
18
+ const items = $('.ag-topic')
19
+ .toArray()
20
+ .map((item) => {
19
21
  item = $(item);
20
- const link = baseUrl + item.find('a').attr('href');
21
- return ctx.cache.tryGet(link, () => ({
22
- title: item.find('h2').text().trim(),
23
- description: item.find('a').attr('href').replace('/topic/', ''),
24
- link,
25
- }));
26
- })
27
- .get();
22
+ return {
23
+ title: item.find('.ag-topic__link').text().trim(),
24
+ description: item.find('.ag-topic__summery').text().trim(),
25
+ link: `${baseUrl}${item.find('.ag-topic__link').attr('href')}`,
26
+ };
27
+ });
28
28
 
29
29
  ctx.state.data = {
30
30
  title: $('head title').text().trim(),
31
- link: baseUrl + '/' + category,
31
+ link,
32
32
  description: $('head meta[name=description]').attr('content'),
33
33
  item: items,
34
34
  language: $('html').attr('lang'),
@@ -36,7 +36,7 @@ module.exports = async (ctx) => {
36
36
 
37
37
  ctx.state.json = {
38
38
  title: $('head title').text().trim(),
39
- link: baseUrl + '/' + category,
39
+ link,
40
40
  description: $('head meta[name=description]').attr('content'),
41
41
  item: items,
42
42
  language: $('html').attr('lang'),
@@ -0,0 +1,37 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+
5
+ const baseUrl = 'https://agirls.aotter.net';
6
+
7
+ const parseArticle = async (item, referer, cookieJar) => {
8
+ const detailResponse = await got({
9
+ url: item.link,
10
+ headers: {
11
+ Referer: referer,
12
+ },
13
+ cookieJar,
14
+ });
15
+ const content = cheerio.load(detailResponse.data);
16
+
17
+ item.category = [
18
+ ...new Set(
19
+ content('.ag-article__tag')
20
+ .toArray()
21
+ .map((e) => content(e).text().trim().replace('#', ''))
22
+ ),
23
+ ];
24
+ const ldJson = JSON.parse(content('script[type="application/ld+json"]').text());
25
+
26
+ item.description = content('.ag-article__content').html();
27
+ item.pubDate = parseDate(ldJson['@graph'][0].datePublished); // 2023-07-05T12:11:36+08:00
28
+ item.updated = parseDate(ldJson['@graph'][0].dateModified); // 2023-07-05T12:11:36+08:00
29
+ item.author = ldJson['@graph'][0].author.map((a) => a.name).join(', ');
30
+
31
+ return item;
32
+ };
33
+
34
+ module.exports = {
35
+ baseUrl,
36
+ parseArticle,
37
+ };
@@ -1,9 +1,5 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
- const { parseDate } = require('@/utils/parse-date');
4
- const timezone = require('@/utils/timezone');
5
- const { art } = require('@/utils/render');
6
- const path = require('path');
7
3
  const HOME_PAGE = 'https://apnews.com';
8
4
 
9
5
  module.exports = async (ctx) => {
@@ -11,35 +7,33 @@ module.exports = async (ctx) => {
11
7
  const url = `${HOME_PAGE}/hub/${topic}`;
12
8
  const response = await got(url);
13
9
  const $ = cheerio.load(response.data);
14
- const data = JSON.parse(
15
- $('script')
16
- .not('[src], [type]')
17
- .text()
18
- .match(/window\['titanium-state'\] = (.*)\nwindow\['titanium-cacheConfig'\]/)[1]
19
- );
20
- const meta = data.hub.data[`/${topic}`];
21
10
 
22
- const items = meta.cards
23
- .filter((c) => c.id.startsWith('urn:publicid:ap.org:'))
24
- .map((item) => {
25
- const description = cheerio.load(item.contents[0].storyHTML, null, false);
26
- description('.ad-placeholder').remove();
27
- return {
28
- title: item.contents[0].headline,
29
- description: art(path.join(__dirname, 'templates/description.art'), {
30
- media: item.contents[0].media,
31
- description: description.html(),
32
- }),
33
- link: `${HOME_PAGE}/article/${item.contents[0].canonicalUrl}-${item.contents[0].shortId}`,
34
- author: item.contents[0].bylines ? item.contents[0].bylines.slice(3) : null,
35
- pubDate: timezone(parseDate(item.contents[0].published), 0),
36
- category: item.contents[0].tagObjs.map((tag) => tag.name),
37
- };
38
- });
11
+ const items = await Promise.all(
12
+ $('.PagePromo-content')
13
+ .get()
14
+ .map((e) => ({
15
+ title: $(e).find('span.PagePromoContentIcons-text').text(),
16
+ link: $(e).find('a').attr('href'),
17
+ }))
18
+ .map((item) =>
19
+ ctx.cache.tryGet(item.link, async () => {
20
+ const { data: response } = await got(item.link);
21
+ const $ = cheerio.load(response);
22
+ $('div.Enhancement').remove();
23
+ return Object.assign(item, {
24
+ pubDate: new Date($("meta[property='article:published_time']").attr('content')),
25
+ updated: new Date($("meta[property='article:modified_time']").attr('content')),
26
+ description: $('div.RichTextStoryBody').html(),
27
+ category: $("meta[property='article:section']").attr('content'),
28
+ guid: $("meta[name='brightspot.contentId']").attr('content'),
29
+ });
30
+ })
31
+ )
32
+ );
39
33
 
40
34
  ctx.state.data = {
41
- title: meta.tagObjs[0].seoTitle,
42
- description: meta.tagObjs[0].seoDescription,
35
+ title: $('title').text(),
36
+ description: $("meta[property='og:description']").text(),
43
37
  link: url,
44
38
  item: items,
45
39
  language: $('html').attr('lang'),
@@ -9,11 +9,12 @@ module.exports = async (ctx) => {
9
9
  const name = ctx.params.name;
10
10
  const url = `${rootUrl}/comic/${name}`;
11
11
 
12
- const response = await got.get(url);
12
+ const response = await got(url);
13
13
  const $ = cheerio.load(response.data);
14
14
  const comicTitle = $('div > div.pure-u-1-1.pure-u-sm-2-3.pure-u-md-3-4 > div > h1').text();
15
15
  const list = $('#layout > div.comics-detail > div:nth-child(3) > div > div:nth-child(4) > div')
16
- .map((_, item) => {
16
+ .toArray()
17
+ .map((item) => {
17
18
  const title = $(item).find('span').text();
18
19
  const link = rootUrl + $(item).find('a').attr('href');
19
20
 
@@ -21,25 +22,18 @@ module.exports = async (ctx) => {
21
22
  title,
22
23
  link,
23
24
  };
24
- })
25
- .get();
25
+ });
26
26
 
27
27
  const items = await Promise.all(
28
28
  list.map((item) =>
29
29
  ctx.cache.tryGet(item.link, async () => {
30
- const directUrlParams = new URLSearchParams(new URL(item.link).search);
31
- const comicId = directUrlParams.get('comic_id');
32
- const sectionSolt = directUrlParams.get('section_slot');
33
- const chapterSlot = directUrlParams.get('chapter_slot');
34
- const descUrl = `https://www.webmota.com/comic/chapter/${comicId}/${sectionSolt}_${chapterSlot}.html`;
35
-
36
- const detailResponse = await got.get(descUrl);
30
+ const detailResponse = await got(item.link);
37
31
  const $ = cheerio.load(detailResponse.data);
38
32
  item.description = art(path.join(__dirname, 'templates/desc.art'), {
39
- imgUrlList: $('section.comic-contain')
33
+ imgUrlList: $('.comic-contain')
40
34
  .find('amp-img')
41
- .map((_, item) => $(item).attr('src'))
42
- .get(),
35
+ .toArray()
36
+ .map((item) => $(item).attr('src')),
43
37
  });
44
38
 
45
39
  return item;
@@ -49,6 +43,7 @@ module.exports = async (ctx) => {
49
43
 
50
44
  ctx.state.data = {
51
45
  title: `包子漫画-${comicTitle}`,
46
+ description: $('.comics-detail__desc').text(),
52
47
  link: url,
53
48
  item: items,
54
49
  };
@@ -1,8 +1,15 @@
1
1
  const got = require('@/utils/got');
2
2
  const cache = require('./cache');
3
+ const config = require('@/config').value;
3
4
 
4
5
  module.exports = async (ctx) => {
5
6
  const uid = ctx.params.uid;
7
+ const loginUid = ctx.params.loginUid;
8
+
9
+ const cookie = config.bilibili.cookies[loginUid];
10
+ if (cookie === undefined) {
11
+ throw Error('缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">bilibili 用户关注动态系列路由</a>');
12
+ }
6
13
 
7
14
  const name = await cache.getUsernameFromUID(ctx, uid);
8
15
 
@@ -20,8 +27,12 @@ module.exports = async (ctx) => {
20
27
  url: `https://api.bilibili.com/x/relation/followers?vmid=${uid}`,
21
28
  headers: {
22
29
  Referer: `https://space.bilibili.com/${uid}/`,
30
+ Cookie: cookie,
23
31
  },
24
32
  });
33
+ if (response.data.code === -6 || response.data.code === -101) {
34
+ throw Error('对应 loginUid 的 Bilibili 用户的 Cookie 已过期');
35
+ }
25
36
  const data = response.data.data.list;
26
37
 
27
38
  ctx.state.data = {
@@ -31,7 +42,7 @@ module.exports = async (ctx) => {
31
42
  item: data.map((item) => ({
32
43
  title: `${name} 新粉丝 ${item.uname}`,
33
44
  description: `${item.uname}<br>${item.sign}<br>总计${count}`,
34
- pubDate: new Date(item.mtime * 1000).toUTCString(),
45
+ pubDate: new Date(item.mtime * 1000),
35
46
  link: `https://space.bilibili.com/${item.mid}`,
36
47
  })),
37
48
  };
@@ -1,7 +1,14 @@
1
1
  const got = require('@/utils/got');
2
2
  const cache = require('./cache');
3
+ const config = require('@/config').value;
3
4
 
4
5
  module.exports = async (ctx) => {
6
+ const loginUid = ctx.params.loginUid;
7
+ const cookie = config.bilibili.cookies[loginUid];
8
+ if (cookie === undefined) {
9
+ throw Error('缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">bilibili 用户关注动态系列路由</a>');
10
+ }
11
+
5
12
  const uid = ctx.params.uid;
6
13
  const name = await cache.getUsernameFromUID(ctx, uid);
7
14
 
@@ -19,8 +26,16 @@ module.exports = async (ctx) => {
19
26
  url: `https://api.bilibili.com/x/relation/followings?vmid=${uid}`,
20
27
  headers: {
21
28
  Referer: `https://space.bilibili.com/${uid}/`,
29
+ Cookie: cookie,
22
30
  },
23
31
  });
32
+ if (response.data.code === -6) {
33
+ throw Error('对应 loginUid 的 Bilibili 用户的 Cookie 已过期');
34
+ }
35
+ // 22115 : 用户已设置隐私,无法查看
36
+ if (response.data.code === 22115) {
37
+ throw Error(response.data.message);
38
+ }
24
39
  const data = response.data.data.list;
25
40
 
26
41
  ctx.state.data = {
@@ -30,7 +45,7 @@ module.exports = async (ctx) => {
30
45
  item: data.map((item) => ({
31
46
  title: `${name} 新关注 ${item.uname}`,
32
47
  description: `${item.uname}<br>${item.sign}<br>总计${count}`,
33
- pubDate: new Date(item.mtime * 1000).toUTCString(),
48
+ pubDate: new Date(item.mtime * 1000),
34
49
  link: `https://space.bilibili.com/${item.mid}`,
35
50
  })),
36
51
  };
@@ -1,4 +1,6 @@
1
1
  const got = require('@/utils/got');
2
+ const utils = require('./utils');
3
+ const cache = require('./cache');
2
4
 
3
5
  module.exports = async (ctx) => {
4
6
  const key = ctx.params.key;
@@ -15,26 +17,32 @@ module.exports = async (ctx) => {
15
17
  orderTitle = '人气直播';
16
18
  break;
17
19
  }
20
+ const verifyString = await cache.getVerifyString(ctx);
21
+ let params = `__refresh__=true&_extra=&context=&page=1&page_size=42&order=${order}&duration=&from_source=&from_spmid=333.337&platform=pc&highlight=1&single_column=0&keyword=${urlEncodedKey}&ad_resource=&source_tag=3&gaia_vtoken=&category_id=&search_type=live&dynamic_offset=0&web_location=1430654`;
22
+ params = utils.addVerifyInfo(params, verifyString);
18
23
 
19
24
  const response = await got({
20
25
  method: 'get',
21
- url: `https://api.bilibili.com/x/web-interface/search/type?search_type=live_room&keyword=${urlEncodedKey}&order=${order}&coverType=user_cover&page=1`,
26
+ url: `https://api.bilibili.com/x/web-interface/wbi/search/type?${params}`,
22
27
  headers: {
23
- Referer: `https://search.bilibili.com/live?keyword=${urlEncodedKey}&order=${order}&coverType=user_cover&page=1&search_type=live`,
28
+ Referer: `https://search.bilibili.com/live?keyword=${urlEncodedKey}&from_source=webtop_search&spm_id_from=444.7&search_source=3&search_type=live_room`,
29
+ Cookie: await cache.getCookie(ctx),
24
30
  },
25
31
  });
26
- const data = response.data.data.result;
32
+ const data = response.data.data.result.live_room;
27
33
 
28
34
  ctx.state.data = {
29
35
  title: `哔哩哔哩直播-${key}-${orderTitle}`,
30
36
  link: `https://search.bilibili.com/live?keyword=${urlEncodedKey}&order=${order}&coverType=user_cover&page=1&search_type=live`,
31
37
  description: `哔哩哔哩直播-${key}-${orderTitle}`,
32
- item: data.map((item) => ({
33
- title: `${item.uname} ${item.title} (${item.cate_name}-${item.live_time})`,
34
- description: `${item.uname} ${item.title} (${item.cate_name}-${item.live_time})`,
35
- pubDate: new Date(item.live_time.replace(' ', 'T') + '+08:00').toUTCString(),
36
- guid: `https://live.bilibili.com/${item.roomid} ${item.live_time}`,
37
- link: `https://live.bilibili.com/${item.roomid}`,
38
- })),
38
+ item:
39
+ data &&
40
+ data.map((item) => ({
41
+ title: `${item.uname} ${item.title} (${item.cate_name}-${item.live_time})`,
42
+ description: `${item.uname} ${item.title} (${item.cate_name}-${item.live_time})`,
43
+ pubDate: new Date(item.live_time.replace(' ', 'T') + '+08:00').toUTCString(),
44
+ guid: `https://live.bilibili.com/${item.roomid} ${item.live_time}`,
45
+ link: `https://live.bilibili.com/${item.roomid}`,
46
+ })),
39
47
  };
40
48
  };
@@ -31,8 +31,8 @@ module.exports = {
31
31
  '/user/collection/:uid/:sid/:disableEmbed?': ['shininome'],
32
32
  '/user/dynamic/:uid/:disableEmbed?': ['DIYgod', 'zytomorrow'],
33
33
  '/user/fav/:uid/:disableEmbed?': ['DIYgod'],
34
- '/user/followers/:uid': ['Qixingchen'],
35
- '/user/followings/:uid': ['Qixingchen'],
34
+ '/user/followers/:uid/:loginUid': ['Qixingchen'],
35
+ '/user/followings/:uid/:loginUid': ['Qixingchen'],
36
36
  '/user/video/:uid/:disableEmbed?': ['DIYgod'],
37
37
  '/user/video-all/:uid/:disableEmbed?': ['CcccFz'],
38
38
  '/video/danmaku/:bvid/:pid?': ['Qixingchen'],
@@ -31,8 +31,8 @@ module.exports = (router) => {
31
31
  router.get('/user/collection/:uid/:sid/:disableEmbed?', require('./userCollection'));
32
32
  router.get('/user/dynamic/:uid/:disableEmbed?', require('./dynamic'));
33
33
  router.get('/user/fav/:uid/:disableEmbed?', require('./userFav'));
34
- router.get('/user/followers/:uid', require('./followers'));
35
- router.get('/user/followings/:uid', require('./followings'));
34
+ router.get('/user/followers/:uid/:loginUid', require('./followers'));
35
+ router.get('/user/followings/:uid/:loginUid', require('./followings'));
36
36
  router.get('/user/video/:uid/:disableEmbed?', require('./video'));
37
37
  router.get('/user/video-all/:uid/:disableEmbed?', require('./video-all'));
38
38
  router.get('/video/danmaku/:bvid/:pid?', require('./danmaku'));
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/news/:language?/:category?': ['nczitzk'],
3
+ };