api/instagram: add file name for proxied image thumbs

This commit is contained in:
wukko 2024-08-22 18:02:53 +06:00
parent 76fa1b2b87
commit fb5d68a830
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -167,7 +167,7 @@ export default function(obj) {
const sidecar = data?.gql_data?.shortcode_media?.edge_sidecar_to_children; const sidecar = data?.gql_data?.shortcode_media?.edge_sidecar_to_children;
if (sidecar) { if (sidecar) {
const picker = sidecar.edges.filter(e => e.node?.display_url) const picker = sidecar.edges.filter(e => e.node?.display_url)
.map(e => { .map((e, i) => {
const type = e.node?.is_video ? "video" : "photo"; const type = e.node?.is_video ? "video" : "photo";
const url = type === "video" ? e.node?.video_url : e.node?.display_url; const url = type === "video" ? e.node?.video_url : e.node?.display_url;
@ -179,7 +179,7 @@ export default function(obj) {
service: "instagram", service: "instagram",
type: "proxy", type: "proxy",
u: e.node?.display_url, u: e.node?.display_url,
filename: "image.jpg" filename: `instagram_${id}_${i + 1}.jpg`
}) })
} }
}); });
@ -203,7 +203,7 @@ export default function(obj) {
const carousel = data.carousel_media; const carousel = data.carousel_media;
if (carousel) { if (carousel) {
const picker = carousel.filter(e => e?.image_versions2) const picker = carousel.filter(e => e?.image_versions2)
.map(e => { .map((e, i) => {
const type = e.video_versions ? "video" : "photo"; const type = e.video_versions ? "video" : "photo";
const imageUrl = e.image_versions2.candidates[0].url; const imageUrl = e.image_versions2.candidates[0].url;
@ -221,7 +221,7 @@ export default function(obj) {
service: "instagram", service: "instagram",
type: "proxy", type: "proxy",
u: imageUrl, u: imageUrl,
filename: "image.jpg" filename: `instagram_${id}_${i + 1}.jpg`
}) })
} }
}); });