mirror of
https://codeberg.org/tacerus/teddit.git
synced 2025-01-24 19:44:06 +01:00
check that gallery id exists
This commit is contained in:
parent
2fbbecac99
commit
fb2fe788c4
@ -116,16 +116,18 @@ module.exports = function(fetch) {
|
|||||||
for(var i = 0; i < post.gallery_data.items.length; i++) {
|
for(var i = 0; i < post.gallery_data.items.length; i++) {
|
||||||
let id = post.gallery_data.items[i].media_id
|
let id = post.gallery_data.items[i].media_id
|
||||||
if(post.media_metadata[id]) {
|
if(post.media_metadata[id]) {
|
||||||
let item = { source: null, thumbnail: null, large: null }
|
if(post.media_metadata[id].p[0]) {
|
||||||
if(post.media_metadata[id].s && post.media_metadata[id].p[0].u) {
|
let item = { source: null, thumbnail: null, large: null }
|
||||||
item = {
|
if(post.media_metadata[id].s && post.media_metadata[id].p[0].u) {
|
||||||
type: post.media_metadata[id].e,
|
item = {
|
||||||
source: await downloadAndSave(post.media_metadata[id].s.u),
|
type: post.media_metadata[id].e,
|
||||||
thumbnail: await downloadAndSave(post.media_metadata[id].p[0].u),
|
source: await downloadAndSave(post.media_metadata[id].s.u),
|
||||||
large: await downloadAndSave(post.media_metadata[id].p[post.media_metadata[id].p.length - 1].u),
|
thumbnail: await downloadAndSave(post.media_metadata[id].p[0].u),
|
||||||
|
large: await downloadAndSave(post.media_metadata[id].p[post.media_metadata[id].p.length - 1].u),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
obj.gallery_items.push(item)
|
||||||
}
|
}
|
||||||
obj.gallery_items.push(item)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user