added support for instagram images

also improved various picker
This commit is contained in:
wukko
2023-08-20 19:14:31 +06:00
parent a15558bc3f
commit dfdda06099
6 changed files with 36 additions and 28 deletions

View File

@ -38,14 +38,12 @@ export default async function(obj) {
data = false;
}
if (!data) return { error: 'ErrorCouldntFetch' };
let single, multiple = [];
const sidecar = data?.shortcode_media?.edge_sidecar_to_children;
if (sidecar) {
sidecar.edges.forEach(e => {
// todo: allow downloading images once frontend supports it
if (e.node?.is_video) {
multiple.push({
type: "video",
@ -58,6 +56,17 @@ export default async function(obj) {
}),
url: e.node?.video_url
})
} else {
multiple.push({
type: "photo",
thumb: createStream({
service: "instagram",
type: "default",
u: e.node?.display_url,
filename: "image.jpg"
}),
url: e.node?.display_url
})
}
})
} else if (data?.shortcode_media?.video_url) {