Created
April 30, 2025 12:29
-
-
Save ZulX88/6f2a1da7920c73261f5df727209c6ea9 to your computer and use it in GitHub Desktop.
Facebook downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import * as cheerio from 'cheerio'; | |
/* | |
* const axios = require('axios') | |
* const cheerio = require('cheerio') | |
*/ | |
async function fbDownload(url) { | |
const formData = new URLSearchParams(); | |
formData.append('id', url); | |
formData.append('locale', 'id'); | |
const { data } = await axios({ | |
method: 'POST', | |
url: 'https://getmyfb.com/process', | |
headers: { | |
'HX-Request': 'true', | |
'HX-Trigger': 'form', | |
'HX-Target': 'target', | |
'HX-Current-URL': 'https://getmyfb.com/id', | |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' | |
}, | |
data: formData.toString() | |
}); | |
const $ = cheerio.load(data); | |
const downloadLink = $('.results-list-item a').first().attr('href'); | |
if (!downloadLink) throw new Error('Video download link not found'); | |
return downloadLink; | |
} | |
//module.exports = fbDownload | |
export default fbDownload; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment