mirror of
https://github.com/oceanprotocol/webtasks
synced 2025-01-08 13:02:53 +01:00
limit Medium image sizes
This commit is contained in:
parent
4e0a322a22
commit
ee91c4795d
@ -19,9 +19,7 @@ app.get('/:username', (req, res) => {
|
|||||||
const parsedPosts = []
|
const parsedPosts = []
|
||||||
let holder = {}
|
let holder = {}
|
||||||
|
|
||||||
if (error) {
|
if (error) return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < posts.length; i++) {
|
for (let i = 0; i < posts.length; i++) {
|
||||||
holder.id = posts[i].id
|
holder.id = posts[i].id
|
||||||
@ -29,7 +27,7 @@ app.get('/:username', (req, res) => {
|
|||||||
holder.readingTime = posts[i].virtuals.readingTime
|
holder.readingTime = posts[i].virtuals.readingTime
|
||||||
holder.title = posts[i].title
|
holder.title = posts[i].title
|
||||||
holder.subtitle = posts[i].virtuals.subtitle
|
holder.subtitle = posts[i].virtuals.subtitle
|
||||||
holder.imageUrl = `https://cdn-images-1.medium.com/${posts[i].virtuals.previewImage.imageId}`
|
holder.imageUrl = `https://cdn-images-1.medium.com/max/600/${posts[i].virtuals.previewImage.imageId}`
|
||||||
holder.postUrl = `https://medium.com/${req.params.username}/${posts[i].id}`
|
holder.postUrl = `https://medium.com/${req.params.username}/${posts[i].id}`
|
||||||
parsedPosts.push(holder)
|
parsedPosts.push(holder)
|
||||||
holder = {}
|
holder = {}
|
||||||
@ -46,9 +44,7 @@ app.get('/:username/raw', (req, res) => {
|
|||||||
const json = JSON.parse(response.body.replace('])}while(1);</x>', ''))
|
const json = JSON.parse(response.body.replace('])}while(1);</x>', ''))
|
||||||
const { posts } = json.payload
|
const { posts } = json.payload
|
||||||
|
|
||||||
if (error) {
|
if (error) return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
res.send(posts)
|
res.send(posts)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user