Closed ascott closed 4 years ago
@ascott do we have a shared Medium account? We need to get an access token.
@jesicarson can you add @paninee as a contributor on the Medium account?
@paninee I will slack you the login creds for medium.
@ascott we can't get the blog posts from Medium using their API https://github.com/Medium/medium-api-docs. It only returns user and publication. i'm working on pulling them as RSS feed and convert them into JSON, but there's no pagination, and probably can only grab 10 blogs. https://medium.com/feed/@participediaproject. would this work for our purpose?
@paninee ok, pulling in the rss and converting to json sounds like a good plan. let's just return the latest 3 posts, which is all we will need for now. if that changes down the road we can we re-assess. btw, maybe you've seen this, but here is an implementation of pulling in the rss feed and returning json: https://github.com/sanctuarycomputer/medium-rss-to-json/blob/master/server.js
@ascott There isn't an imageUrl
. The images are part of the content. I will extract the first from the blog's body using https://stackoverflow.com/questions/14939296/extract-image-src-from-a-string/15013465.
Sample response.
{
"blogPosts": [
{
"id": "https://medium.com/p/25d3f968255d",
"title": "Governance Snapshots: \nAdaptations, Innovations and Practitioner Learning in a Time of COVID-19",
"author": "Participedia",
"createdAt": 1590512041000,
"description": "<h3><strong>Governance Snapshots: <br>Adaptations, Innovations and Practitioner Learning in a Time of COVID-19</strong></h3><p><em>By Julien Landry and Ann Marie Smith, with Patience Agwenjang, Patricia Blankson Akakpo, Jagat Basnet, Bhumiraj Chapagain, Aklilu Gebremichael, Barba",
"url": "https://medium.com/@participediaproject/governance-snapshots-adaptations-innovations-and-practitioner-learning-in-a-time-of-covid-19-25d3f968255d?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/880/1*22UKYhauICJxhbT65vdvtg.jpeg"
},
{
"id": "https://medium.com/p/88898c5c54dc",
"title": "Covid-19 Response: Participatory Innovations in Pandemic Times",
"author": "Participedia",
"createdAt": 1586201569000,
"description": "<p><em>By the Participedia Team</em></p><p>Amid the Covid-19 pandemic, face-to-face contact is no longer safe. Communities everywhere are scrambling to combat the mounting crisis of overloaded healthcare systems, while also undertaking new practices of social distancing (and isol",
"url": "https://medium.com/@participediaproject/covid-19-response-participatory-innovations-in-pandemic-times-88898c5c54dc?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/1024/1*ZFrElPuInHl263tEu1iP1A.jpeg"
},
{
"id": "https://medium.com/p/119091463726",
"title": "Accessing social grants in South Africa: Participatory research for social change",
"author": "Participedia",
"createdAt": 1583171685000,
"description": "<p><em>By Professor Laurence Piper with Research Assistants Robyn Pasensie and Sondre Bailey, University of the Western Cape, Participedia Team</em></p><p>A team of Participedia researchers from the <a href=\"https://participedia.net/organization/5784\">University of the Western Ca",
"url": "https://medium.com/@participediaproject/accessing-social-grants-in-south-africa-participatory-research-for-social-change-119091463726?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/1024/1*xXbrrT5YQ-Te1t_HjsdUEw.jpeg"
},
{
"id": "https://medium.com/p/515056b64364",
"title": "How to inspire the world in under 5 minutes",
"author": "Participedia",
"createdAt": 1570292375000,
"description": "<p>By <a href=\"https://participedia.net/user/1189\">Jesi Carson</a>, Lead Designer & Communities Coordinator, Participedia</p><p>We’re facing some of the biggest challenges in human history — social, environmental, you name it — and our democratic institutions just aren’t cutt",
"url": "https://medium.com/@participediaproject/how-to-inspire-the-world-in-under-5-minutes-515056b64364?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/1024/1*FL36oF0ybXpUF18KOcBhEw.jpeg"
},
{
"id": "https://medium.com/p/cdcf00a81275",
"title": "What does democratic participation mean in contexts of fragility, violence and conflict?",
"author": "Participedia",
"createdAt": 1570118484000,
"description": "<p>Gabriela de la Torre Rios & Angela Pajuelo Villón, <br>Institute of Development Studies</p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/1024/1*E-ePNaYQnEKUtCFR58UmTA.jpeg\" /><figcaption>Power to the People السلطة للشعب (<a href=\"https://www.flickr.com/photo",
"url": "https://medium.com/@participediaproject/what-does-democratic-participation-mean-in-contexts-of-fragility-violence-and-conflict-cdcf00a81275?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/1024/1*E-ePNaYQnEKUtCFR58UmTA.jpeg"
},
{
"id": "https://medium.com/p/3a2f2e1f9ea4",
"title": "Democracy’s not as broken as you’d think — here’s how we prove that",
"author": "Participedia",
"createdAt": 1569514636000,
"description": "<h3>Democracy’s not as broken as you’d think — here’s how we prove that</h3><p>By Scott Fletcher, Managing Editor, Participedia</p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/635/1*HS55Hntz8PG73M4oR3boFw.gif\" /><figcaption>I used to think democracy meant voting e",
"url": "https://medium.com/@participediaproject/https-medium-com-participediaproject-democracys-not-as-broken-an-youd-think-3a2f2e1f9ea4?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/635/1*HS55Hntz8PG73M4oR3boFw.gif"
},
{
"id": "https://medium.com/p/2fac4cff4e0c",
"title": "We’re harnessing the power of the internet to innovate democracy",
"author": "Participedia",
"createdAt": 1568911370000,
"description": "<p>The Participedia Team</p><p>For the first instalment in our 3-part tell-all, we went right to the source: Participedia co-founder Dr. Mark Warren! Professor of Political Science and the Harold and Dorrie Merilees Chair for the Study of Democracy, Dr. Warren is lead investigato",
"url": "https://medium.com/@participediaproject/were-harnessing-the-power-of-the-internet-to-document-and-save-democracy-2fac4cff4e0c?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/400/0*z-FMTA1m5R-VU6wP.jpg"
},
{
"id": "https://medium.com/p/daee6453d9d7",
"title": "Inspiring hope for democracy: the past, present, and future of Participedia",
"author": "Participedia",
"createdAt": 1568822691000,
"description": "<p>The Participedia Team</p><p>Truth is, we’re facing some of the biggest challenges in human history, and many of us feel powerless to do anything. There is growing disenchantment with the ability of democracy to meet people’s aspirations and concerns, but that doesn’t mean ther",
"url": "https://medium.com/@participediaproject/inspiring-hope-for-democracy-the-past-present-and-future-of-participedia-daee6453d9d7?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/1024/1*XBGkCsK0d0GXOBGhXYbd7g.jpeg"
},
{
"id": "https://medium.com/p/fcdb5fddb0c8",
"title": "Engaging the disengaged: 5 messaging strategies to increase voter turnout",
"author": "Participedia",
"createdAt": 1564689886000,
"description": "<p>Ofer Berenstein, University of Calgary</p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/1024/1*driN3ekSHmweeIqyN5uzuA.png\" /><figcaption><strong>Left</strong>: The 2014 US midterm elections saw the national turnout drop to a 50-year low of 36.4% (swaksalot/Flick",
"url": "https://medium.com/@participediaproject/engaging-the-disengaged-5-messaging-strategies-to-increase-voter-turnout-fcdb5fddb0c8?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/1024/1*driN3ekSHmweeIqyN5uzuA.png"
},
{
"id": "https://medium.com/p/b21d5b4e9d7a",
"title": "Communicating Effectively: How Solutions Journalism Gets People to Care About Climate Change",
"author": "Participedia",
"createdAt": 1564332628000,
"description": "<h3><strong>Communicating effectively: how solutions journalism gets people to care about climate change</strong></h3><p>By Kamyar Razavi</p><p>In a May episode of <em>Last Week Tonight With John Oliver</em>, Bill Nye the Science Guy took a <a href=\"https://twitter.com/girlsreall",
"url": "https://medium.com/@participediaproject/communicating-effectively-how-solutions-journalism-gets-people-to-care-about-climate-change-b21d5b4e9d7a?source=rss-4e7f7d842e0a------2",
"imageUrl": "https://cdn-images-1.medium.com/max/754/0*l8v5uVJJ1cYB5IYO"
}
]
}
Deployed. Have not tested on production because it's only API change.
this is great, thanks @paninee !
This endpoint should pull in the latest blog posts from our Medium blog. https://github.com/Medium/medium-api-docs
a GET request to
https://participeida.net/blog-posts
should return the following json:The posts should be returned ordered by createdAt date with most recent posts at the top.
Arguments: