mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-12 20:25:06 +01:00
spacing
no need for closest quality btw
This commit is contained in:
parent
1504a8bae9
commit
866792c8d5
1 changed files with 18 additions and 23 deletions
|
@ -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`,
|
||||||
|
|
Loading…
Reference in a new issue