fix(route): broken item URL in Google Scholar Author Citations (#14277)
* fix broken url in item fields * add author information in item field * add query parameter usage * fine-tune channel title&description * add maintainer * shorten the itemUrl definition ---------
This commit is contained in:
parent
0dc664ea9f
commit
cdb6f6f34c
|
|
@ -3,7 +3,6 @@ const cheerio = require('cheerio');
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
let description = `Google Scholar Citation Monitor: ${id};`;
|
||||
const BASE_URL = `https://scholar.google.com`;
|
||||
const url = `https://scholar.google.com/citations?user=${id}`;
|
||||
|
||||
|
|
@ -17,27 +16,27 @@ module.exports = async (ctx) => {
|
|||
const profile = $('#gsc_prf .gsc_prf_il').eq(0).text();
|
||||
const homePage = $('#gsc_prf_ivh a').attr('href');
|
||||
const name = $('#gsc_prf_in').text();
|
||||
description += `name: ${name}; profile: ${profile}; homePage: ${homePage}`;
|
||||
const description = `Google Scholar Citation Monitor: ${name}; Profile: ${profile}; HomePage: ${homePage}`;
|
||||
|
||||
const list = $('#gsc_a_b .gsc_a_tr').get();
|
||||
|
||||
const out = list.map((item) => {
|
||||
const $ = cheerio.load(item);
|
||||
|
||||
let itemUrl = $('.gsc_a_t a').attr('data-href');
|
||||
itemUrl = BASE_URL + itemUrl;
|
||||
const itemUrl = BASE_URL + $('.gsc_a_t a').attr('href');
|
||||
|
||||
const author = $('.gsc_a_t div').eq(0).text();
|
||||
const publication = $('.gsc_a_t div').eq(1).text();
|
||||
return {
|
||||
title: $('.gsc_a_t a').text(),
|
||||
author,
|
||||
description: `Author: ${author}; Publication: ${publication}`,
|
||||
link: itemUrl,
|
||||
guid: itemUrl,
|
||||
};
|
||||
});
|
||||
ctx.state.data = {
|
||||
title: `Google Scholar Citation Monitor: ${id}`,
|
||||
title: `Google Scholar: ${name}`,
|
||||
link: url,
|
||||
description,
|
||||
item: out,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = {
|
||||
'/album/:id': ['hoilc'],
|
||||
'/alerts/:keyword': ['TonyRL'],
|
||||
'/citations/:id': ['KellyHwong'],
|
||||
'/citations/:id': ['KellyHwong', 'const7'],
|
||||
'/doodles/:language?': ['xyqfer'],
|
||||
'/fonts/:sort?': ['Fatpandac'],
|
||||
'/news/:category/:locale': ['zoenglinghou'],
|
||||
|
|
|
|||
|
|
@ -165,8 +165,10 @@
|
|||
|
||||
### Author Citations {#google-scholar-author-citations}
|
||||
|
||||
<Route author="KellyHwong" example="/google/citations/mlmE4JMAAAAJ" path="/google/citations/:id" anticrawler="1">
|
||||
The parameter id in the route is the id in the URL of the user's Google Scholar reference page, for example `https://scholar.google.com/citations?hl=zh-CN&user=mlmE4JMAAAAJ` to `mlmE4JMAAAAJ`
|
||||
<Route author="KellyHwong const7" example="/google/citations/mlmE4JMAAAAJ" path="/google/citations/:id" anticrawler="1">
|
||||
The parameter id in the route is the id in the URL of the user's Google Scholar reference page, for example `https://scholar.google.com/citations?user=mlmE4JMAAAAJ` to `mlmE4JMAAAAJ`.
|
||||
|
||||
Query parameters are also supported here, for example `https://scholar.google.com/citations?user=mlmE4JMAAAAJ&sortby=pubdate` to `mlmE4JMAAAAJ&sortby=pubdate`. Please make sure that the user id (`mlmE4JMAAAAJ` in this case) should be the first parameter in the query string.
|
||||
</Route>
|
||||
|
||||
## IEEE Computer Society {#ieee-computer-society}
|
||||
|
|
|
|||
Loading…
Reference in New Issue