Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
medium-json-feed
Advanced tools
Get Medium latest articles in JSON format
Medium's public API is quite limited and it is not possible to fetch data from browsers due to CORS issue. Use this package in your server to get JSON article list from Medium or fork and deploy this minimum server to Heroku or another PaaS.
npm install medium-json-feed --save
Gets the user/publication name and an optional callback or stream. Returns a promise.
mediumJSONFeed(endpoint: string, callback?: Function | Stream): Promise
Simple example:
const mediumJSONFeed = require('medium-json-feed');
// Usernames start with '@'
mediumJSONFeed('@my-user-name')
.then(data => ...)
.catch(data => ...);
// Publication names without '@'
mediumJSONFeed('my-publication-name', data => ...);
// Medium's top page (trending posts)
mediumJSONFeed().then(data => ...);
Other endpoint examples are @user-name/latest
, publication-name/latest
or publication-name/trending
.
The data
response contains:
data.status
: HTTP status code (number).data.error
: Error message if exists (string).data.response
: List of found articles (Array). The format is the one returned by Medium. Inspect data.response[...].content
and data.response[...].virtuals
for useful information.To get the full raw response given by Medium, provide a stream:
// Raw stream pipe to stdout
mediumJSONFeed('@my-user-name', process.stdout);
// Raw stream pipe to server's response
mediumJSONFeed('@my-user-name', response);
Note: the raw output will likely contain random chacters at the beginning of the string that break JSON format.
For a full example, see server.js
file.
See The Web Tub's trending articles or Mikeal Roger's latest articles.
PORT
and ORIGIN
(for Access-Control-Allow-Origin
header).FAQs
Get Medium latest articles in JSON format
The npm package medium-json-feed receives a total of 11 weekly downloads. As such, medium-json-feed popularity was classified as not popular.
We found that medium-json-feed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.