mirror of
https://github.com/imputnet/cobalt.git
synced 2025-01-06 07:06:02 +00:00
instagram: add downloading of single image
merge pull request #180 from dumbmoron/instagram-single-image
This commit is contained in:
commit
9cddda442e
|
@ -18,6 +18,7 @@ export default function(r, host, audioFormat, isAudioOnly, lang, isAudioMuted) {
|
||||||
if (isAudioOnly && !r.picker) action = "audio";
|
if (isAudioOnly && !r.picker) action = "audio";
|
||||||
if (r.picker) action = "picker";
|
if (r.picker) action = "picker";
|
||||||
if (isAudioMuted) action = "muteVideo";
|
if (isAudioMuted) action = "muteVideo";
|
||||||
|
if (r.isPhoto) action = "photo";
|
||||||
|
|
||||||
if (action === "picker" || action === "audio") {
|
if (action === "picker" || action === "audio") {
|
||||||
defaultParams.filename = r.audioFilename;
|
defaultParams.filename = r.audioFilename;
|
||||||
|
@ -26,6 +27,9 @@ export default function(r, host, audioFormat, isAudioOnly, lang, isAudioMuted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
case "photo":
|
||||||
|
responseType = 1;
|
||||||
|
break;
|
||||||
case "video":
|
case "video":
|
||||||
switch (host) {
|
switch (host) {
|
||||||
case "bilibili":
|
case "bilibili":
|
||||||
|
|
|
@ -71,6 +71,11 @@ export default async function(obj) {
|
||||||
})
|
})
|
||||||
} else if (data?.shortcode_media?.video_url) {
|
} else if (data?.shortcode_media?.video_url) {
|
||||||
single = data.shortcode_media.video_url
|
single = data.shortcode_media.video_url
|
||||||
|
} else if (data?.shortcode_media?.display_url) {
|
||||||
|
return {
|
||||||
|
urls: data?.shortcode_media?.display_url,
|
||||||
|
isPhoto: true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return { error: 'ErrorEmptyDownload' }
|
return { error: 'ErrorEmptyDownload' }
|
||||||
}
|
}
|
||||||
|
|
|
@ -850,6 +850,14 @@
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
"instagram": [{
|
"instagram": [{
|
||||||
|
"name": "single photo post",
|
||||||
|
"url": "https://www.instagram.com/p/CwIgW8Yu5-I/",
|
||||||
|
"params": {},
|
||||||
|
"expected": {
|
||||||
|
"code": 200,
|
||||||
|
"status": "redirect"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
"name": "various picker (photos + video)",
|
"name": "various picker (photos + video)",
|
||||||
"url": "https://www.instagram.com/p/CvYrSgnsKjv/",
|
"url": "https://www.instagram.com/p/CvYrSgnsKjv/",
|
||||||
"params": {},
|
"params": {},
|
||||||
|
|
Loading…
Reference in a new issue