no need for closest quality btw
This commit is contained in:
wukko 2023-10-14 23:48:06 +06:00
parent 1504a8bae9
commit 866792c8d5

View file

@ -56,8 +56,7 @@ async function getPost(id) {
const sidecar = data?.shortcode_media?.edge_sidecar_to_children; const sidecar = data?.shortcode_media?.edge_sidecar_to_children;
if (sidecar) { if (sidecar) {
const picker = sidecar.edges const picker = sidecar.edges.filter(e => e.node?.display_url)
.filter(e => e.node?.display_url)
.map(e => { .map(e => {
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;
@ -123,11 +122,7 @@ async function getStory(username, id) {
if (!item) return { error: 'ErrorEmptyDownload' }; if (!item) return { error: 'ErrorEmptyDownload' };
if (item.video_versions) { if (item.video_versions) {
// todo: closest quality? const video = item.video_versions.reduce((a, b) => a.width * a.height < b.width * b.height ? b : a)
const video = item.video_versions.reduce(
(a, b) => a.width * a.height < b.width * b.height ? b : a
)
return { return {
urls: video.url, urls: video.url,
filename: `instagram_${id}.mp4`, filename: `instagram_${id}.mp4`,