Skip to content

Commit 3ba9f9c

Browse files
sujinjoshiGatsbyJS BotomonkwardpeetLB
authoredMar 2, 2020
fix(gatsby-source-medium): fix data fecthing & add limitation to readme (#17547)
* Temporary workaround for Medium CAPTCA issue * chore(gatsby-source-medium): updated README to mention the limitation and remove limit option from query * Fix README Prettier issues * Update packages/gatsby-source-medium/README.md Co-Authored-By: LB <laurie@gatsbyjs.com> * chore: format Co-authored-by: GatsbyJS Bot <mathews.kyle+gatsbybot@gmail.com> Co-authored-by: Ollie Monk <omonk@users.noreply.github.com> Co-authored-by: Ward Peeters <ward@coding-tech.com> Co-authored-by: LB <laurie@gatsbyjs.com>
1 parent 8f75304 commit 3ba9f9c

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed
 

‎packages/gatsby-source-medium/README.md

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# gatsby-source-medium
22

33
Source plugin for pulling data into Gatsby from an unofficial Medium JSON
4-
endpoint. Unfortunately the JSON endpoint does not provide the complete stories,
5-
but only previews. If you need the complete stories, you might have a look at
6-
something like
4+
endpoint. Unfortunately the JSON endpoint does not provide the complete stories, but only previews. And due to a limitation placed by Medium, only the most recent 10 posts are returned. If you need the complete stories, you might have a look at something like
75
[gatsby-source-rss](https://github.com/jondubin/gatsby-source-rss).
86

97
## Install
@@ -19,7 +17,6 @@ plugins: [
1917
resolve: `gatsby-source-medium`,
2018
options: {
2119
username: `username/publication`,
22-
limit: 200,
2320
},
2421
},
2522
]
@@ -31,14 +28,6 @@ plugins: [
3128

3229
Remember that if you are fetching a user, prepend your username with `@`.
3330

34-
#### Limit
35-
36-
**Note: this only affects requests for users and not publications.**
37-
38-
Limit is optional and will default to 100.
39-
40-
You must set a higher limit if you want more than 100 posts. If you want fewer, you can either use this setting, or add a limit parameter to your graphql query.
41-
4231
## How to query
4332

4433
Get all posts with the preview image ID and the author's name:

‎packages/gatsby-source-medium/src/gatsby-node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const axios = require(`axios`)
22

33
const fetch = (username, limit = 100) => {
4-
const url = `https://medium.com/${username}/latest?format=json&limit=${limit}`
4+
const url = `https://medium.com/${username}/?format=json&limit=${limit}`
55
return axios.get(url)
66
}
77

0 commit comments

Comments
 (0)
Please sign in to comment.