-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
feat(route): add orcid #7582
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/diy/rsshub-do-not-use/6QfGHNyEdU39S7oeJnGroRgewacj |
Successfully generated as following: https://rsshub-do-not-use-ah0vcm4pb-diy.vercel.app/orcid/0000-0002-4731-9700 - Success
|
Successfully generated as following: https://rsshub-do-not-use-6fexzmu6c-diy.vercel.app/orcid/0000-0002-4731-9700 - Success
|
There was a problem hiding this 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
### 每日精选 | ||
|
||
<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"/> |
There was a problem hiding this comment.
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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary changes
lib/routes/natgeo/dailyselection.js
Outdated
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, | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary changes
lib/routes/natgeo/dailyphoto.js
Outdated
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, | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary changes
lib/routes/orcid/index.js
Outdated
const got = require('@/utils/got'); | ||
|
||
module.exports = async (ctx) => { | ||
const id = ctx.params.id || ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const id = ctx.params.id || ''; | |
const id = ctx.params.id ?? ''; |
lib/routes/orcid/index.js
Outdated
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}`, |
There was a problem hiding this comment.
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
Deployment failed with the following error:
Learn More: http://vercel.link/fair-use |
该 PR 相关 Issue / Involved issue
Close #7527
完整路由地址 / Example for the proposed route(s)
新RSS检查列表 / New RSS Script Checklist
Puppeteer
? Make use ofPuppeteer
?说明 / Note