Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): add orcid #7582

Merged
merged 25 commits into from
Feb 20, 2022
Merged

feat(route): add orcid #7582

merged 25 commits into from
Feb 20, 2022

Conversation

OrangeEd1t
Copy link

该 PR 相关 Issue / Involved issue

Close #7527

完整路由地址 / Example for the proposed route(s)

/orcid/0000-0002-4731-9700

新RSS检查列表 / New RSS Script Checklist

  • 这个PR中包含了新的路由吗? Does this PR add new route?
    • 如果有, 请完成检查列表. If yes, please finish the check list
    • 如果你的PR符合下方某个事项, 也请注明. If any of the checklist item meets your PR, please fill it out.
    • <- 这样打勾
  • 是否提供了文档? Documentation provided?
    • 是否提供了英文文档? EN Documentation provided?
  • 是否支持全文获取? Is this RSS Script support fulltext?
    • 如果全文获取中需要访问文章链接, 是否使用了缓存? If fulltext requires to fetch detail pages, is cache used in the process?
    • 缓存说明 | How to use cache
  • 目标是否有明显的反爬/频率限制? Is there any sign of anti-bot or rate limit?
    • 如果有, 是否有对应的措施? (延长缓存时间, 写文档说明, etc.) If yes, do your code reflect this sign? (e.g. write documentations, use long cache time)
  • 目标是否有提供日期? Is there a date in the source?
    • 如果有,包是否正确解析? If there is, can this script provide this info?
    • 如果有提供解析能力,时区是否正确调整? Is the timezone correctly provided?
    • 如果有提供日期,但是没有提供解析,请说明原因 If there is a date but this script does not parse, please provide your reason.
  • 是否引入的新的包? Any new package introduced?
    • 如果有, 请说明原因. If yes, please state your reason
  • 是否使用了Puppeteer? Make use of Puppeteer?
    • 如果有, 请说明原因. If yes, please state your reason

说明 / Note

  • 只获取了前20条数据

@vercel
Copy link

vercel bot commented May 26, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/diy/rsshub-do-not-use/6QfGHNyEdU39S7oeJnGroRgewacj
✅ Preview: https://rsshub-do-not-use-git-fork-orangeed1t-issues-7527-diy.vercel.app

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-do-not-use-ah0vcm4pb-diy.vercel.app/orcid/0000-0002-4731-9700 - Success
    <?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"

>
    <channel>
        <title><![CDATA[ORCID Works List]]></title>
        <link>https://orcid.org/0000-0002-4731-9700/worksPage.json?offset=0&#38;sort=date&#38;sortAsc=false&#38;pageSize=20</link>
        <atom:link href="https://rsshub-do-not-use-ah0vcm4pb-diy.vercel.app/orcid/0000-0002-4731-9700" rel="self" type="application/rss+xml" />
        <description><![CDATA[ORCID Works List - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>i@diygod.me (DIYgod)</webMaster>
        
        
        
        <language>zh-cn</language>
        
        <lastBuildDate>Wed, 26 May 2021 08:28:42 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[A genetic assessment of the taxonomic status of New Zealand mussels of the genus Xenostrobus Wilson, 1967]]></title>
            <description><![CDATA[<h2>A genetic assessment of the taxonomic status of New Zealand mussels of the genus Xenostrobus Wilson, 1967</h2><h3>New Zealand Journal of Marine and Freshwater Research</h3><span>2020-04-02 | journal-article</span><br><span>doi: 10.1080/00288330.2020.1713180(URL: https://doi.org/10.1080/00288330.2020.1713180)<br></span><span>Source: Crossref</span>]]></description>
            
            <guid isPermaLink="false">68125327</guid>
            <link></link>
            
            
            
            
            

@github-actions github-actions bot added the Auto: Route Test Complete Auto route test has finished on given PR label May 26, 2021
@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-do-not-use-6fexzmu6c-diy.vercel.app/orcid/0000-0002-4731-9700 - Success
    <?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"

>
    <channel>
        <title><![CDATA[ORCID Works List]]></title>
        <link>https://orcid.org/0000-0002-4731-9700/worksPage.json?offset=0&#38;sort=date&#38;sortAsc=false&#38;pageSize=20</link>
        <atom:link href="https://rsshub-do-not-use-6fexzmu6c-diy.vercel.app/orcid/0000-0002-4731-9700" rel="self" type="application/rss+xml" />
        <description><![CDATA[ORCID Works List - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>i@diygod.me (DIYgod)</webMaster>
        
        
        
        <language>zh-cn</language>
        
        <lastBuildDate>Wed, 26 May 2021 08:34:55 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[A genetic assessment of the taxonomic status of New Zealand mussels of the genus Xenostrobus Wilson, 1967]]></title>
            <description><![CDATA[<h2>A genetic assessment of the taxonomic status of New Zealand mussels of the genus Xenostrobus Wilson, 1967</h2><h3>New Zealand Journal of Marine and Freshwater Research</h3><span>2020-04-02 | journal-article</span><br><span>doi: 10.1080/00288330.2020.1713180(URL: https://doi.org/10.1080/00288330.2020.1713180)<br></span><span>Source: Crossref</span>]]></description>
            
            <guid isPermaLink="false">68125327</guid>
            <link></link>
            
            
            
            
            

Copy link
Collaborator

@TonyRL TonyRL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2 script standard #8236

docs/picture.md Outdated
Comment on lines 367 to 373
### 每日精选

<Route author="OrangeEd1t" example="/natgeo/dailyselection" path="/natgeo/dailyselection"/>

### 每日一图

<Route author="LogicJake" example="/natgeo/dailyphoto" path="/natgeo/dailyphoto"/>
<Route author="LogicJake & OrangeEd1t" example="/natgeo/dailyphoto" path="/natgeo/dailyphoto"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary changes

lib/router.js Outdated
@@ -407,6 +407,7 @@ router.get('/sexinsex/:id/:type?', require('./routes/sexinsex/index'));
router.get('/gcores/category/:category', require('./routes/gcores/category'));

// 国家地理
router.get('/natgeo/dailyselection', require('./routes/natgeo/dailyselection'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary changes

Comment on lines 1 to 43
const got = require('@/utils/got');
const timezone = require('@/utils/timezone');
const {
parseDate
} = require('@/utils/parse-date');

module.exports = async (ctx) => {
const host = 'http://dili.bdatu.com/jiekou/mains/p1.html';
const data = await got.get(host);

let sort = 0;
let addtime = '';

for (let i = 0; i < data.data.album.length; i++) {
if (parseInt(data.data.album[i].ds) === 1) {
sort = data.data.album[i].sort;
addtime = data.data.album[i].addtime;
break;
}
}
const api = 'http://dili.bdatu.com/jiekou/albums/a' + sort + '.html';
const response = await got.get(api);
const items = response.data.picture;
const out = new Array;

items.map((item) => {
const info = {
title: item.title,
link: item.url,
description: `<img src="${item.url}"><br>` + item.content,
pubDate: timezone(parseDate(addtime), +0),
guid: item.id,
};
out.push(info);
return info;
});

ctx.state.data = {
title: 'Photo of the Daily Selection',
link: api,
item: out,
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary changes

Comment on lines 1 to 35
const got = require('@/utils/got');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const today = new Date();
const year = today.getFullYear();
const month = today.getMonth() + 1;
const browser = await require('@/utils/puppeteer')();
const page = await browser.newPage();
const link = 'https://www.nationalgeographic.com/photo-of-the-day/media-spotlight/';
await page.goto(link);
const html = await page.evaluate(
() =>
document.querySelector('div.InlineGallery').innerHTML
);
browser.close();

const api = `https://www.nationalgeographic.com/content/photography/en_US/photo-of-the-day/_jcr_content/.gallery.${year}-${month}.json`;
const response = await got.get(api);
const items = response.data.items;
const $ = cheerio.load(html);

const out = items.slice(0, 10).map((item) => {
const info = {
title: item.image.title,
author: item.image.credit && item.image.credit.replace('Photograph by ', ''),
link: item.pageUrl,
description: `<img src="${item.image.uri}">` + item.image.caption,
};
return info;
});
const imgUrl = $('img').attr('src');
const title = $('p.Caption__Title').text();
const description = $('span.RichText').text();
const author = $('span.Caption__Credit').text();

const out = new Array;

const info = {
title: title,
link: link,
description: `<img src="${imgUrl}"><br>` + 'Photography by: ' + author + '<br>' + description,
};
out.push(info);

ctx.state.data = {
title: 'Photo of the Day',
link: 'https://www.nationalgeographic.com/photography/photo-of-the-day/',
title: 'Photo Of The Day',
link: link,
item: out,
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary changes

const got = require('@/utils/got');

module.exports = async (ctx) => {
const id = ctx.params.id || '';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const id = ctx.params.id || '';
const id = ctx.params.id ?? '';

const info = {
title: work.title.value,
link: work.url,
description: `<h2>${work.title.value}</h2><h3>${work.journalTitle.value}</h3><span>${work.publicationDate.year ? `${work.publicationDate.year}-` : ``}${work.publicationDate.month}${work.publicationDate.day ? `-${work.publicationDate.day}` : ``} | ${work.workType.value}</span><br><span>${Str}</span><span>Source: ${work.sourceName}`,
Copy link
Collaborator

@TonyRL TonyRL Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use art-template to create HTML #8359

@TonyRL TonyRL changed the title Issues #7527 feat(route): add orcid Feb 1, 2022
@vercel
Copy link

vercel bot commented Feb 20, 2022

Deployment failed with the following error:

Your Personal Account exceeded our fair use limits and has been blocked.

Learn More: http://vercel.link/fair-use

@TonyRL TonyRL merged commit 75cb4f9 into DIYgod:master Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto: Route Test Complete Auto route test has finished on given PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ORCID的works路由请求
2 participants