forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #948 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
28 changed files
with
709 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const config = require('@/config').value; | ||
|
||
const parseArticle = require('./parse-article.js'); | ||
const { getFollowingFeedQuery } = require('./graphql.js'); | ||
|
||
module.exports = async (ctx) => { | ||
const user = ctx.params.user; | ||
|
||
const cookie = config.medium.cookies[user]; | ||
if (cookie === undefined) { | ||
throw Error(`缺少 Medium 用户 ${user} 登录后的 Cookie 值`); | ||
} | ||
|
||
const posts = await getFollowingFeedQuery(user, cookie); | ||
ctx.state.json = posts; | ||
|
||
if (!posts) { | ||
// login failed | ||
throw Error(`Medium 用户 ${user} 的 Cookie 无效或已过期`); | ||
} | ||
|
||
const urls = posts.items.map((data) => data.post.mediumUrl); | ||
|
||
const parsedArticles = await Promise.all(urls.map((url) => parseArticle(ctx, url))); | ||
|
||
ctx.state.data = { | ||
title: `${user} Medium Following`, | ||
link: 'https://medium.com/?feed=following', | ||
item: parsedArticles, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const config = require('@/config').value; | ||
|
||
const parseArticle = require('./parse-article.js'); | ||
const { getWebInlineRecommendedFeedQuery } = require('./graphql.js'); | ||
|
||
module.exports = async (ctx) => { | ||
const user = ctx.params.user; | ||
|
||
const cookie = config.medium.cookies[user]; | ||
if (cookie === undefined) { | ||
throw Error(`缺少 Medium 用户 ${user} 登录后的 Cookie 值`); | ||
} | ||
|
||
const posts = await getWebInlineRecommendedFeedQuery(user, cookie); | ||
ctx.state.json = posts; | ||
|
||
if (!posts) { | ||
// login failed | ||
throw Error(`Medium 用户 ${user} 的 Cookie 无效或已过期`); | ||
} | ||
|
||
const urls = posts.items.map((data) => data.post.mediumUrl); | ||
|
||
const parsedArticles = await Promise.all(urls.map((url) => parseArticle(ctx, url))); | ||
|
||
ctx.state.data = { | ||
title: `${user} Medium For You`, | ||
link: 'https://medium.com/', | ||
item: parsedArticles, | ||
}; | ||
}; |
Oops, something went wrong.
52e8e14
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.
Successfully deployed to the following URLs:
rsshub-master – ./
rsshub-master.vercel.app
rsshub-master-auto-bot-ty.vercel.app
rsshub-master-git-master-auto-bot-ty.vercel.app