mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 19:28:29 +00:00
chore: clean up removing unnecessarily code
This commit is contained in:
parent
f1b1d35ea9
commit
fcec613c84
@ -47,26 +47,21 @@ export default async function (sourceUrl, { shortLink, username, id }) {
|
||||
if (!html) return { error: 'ErrorCouldntFetch' };
|
||||
|
||||
const urls = []
|
||||
const hd = html.match('"browser_native_hd_url":"(.*?)"')
|
||||
const sd = html.match('"browser_native_sd_url":"(.*?)"')
|
||||
const hd = html.match('"browser_native_hd_url":(".*?")')
|
||||
const sd = html.match('"browser_native_sd_url":(".*?")')
|
||||
|
||||
if (hd?.length) {
|
||||
urls.push(JSON.parse(`["${hd[1]}"]`)[0])
|
||||
if (hd?.[1]) {
|
||||
urls.push(JSON.parse(hd[1]))
|
||||
}
|
||||
if (sd?.length) {
|
||||
urls.push(JSON.parse(`["${sd[1]}"]`)[0])
|
||||
if (sd?.[1]) {
|
||||
urls.push(JSON.parse(sd[1]))
|
||||
}
|
||||
|
||||
if (!urls.length) {
|
||||
return { error: 'ErrorEmptyDownload' };
|
||||
}
|
||||
|
||||
let filename = `facebook_${id}.mp4`
|
||||
if (isShortLink) {
|
||||
filename = `facebook_${shortLink}.mp4`
|
||||
} else if (username?.length && username !== 'user') {
|
||||
filename = `facebook_${username}_${id}.mp4`
|
||||
}
|
||||
let filename = `facebook_${id || shortLink}.mp4`
|
||||
|
||||
return {
|
||||
urls: urls[0],
|
||||
|
Loading…
Reference in New Issue
Block a user