Skip to content

Instantly share code, notes, and snippets.

@ZulX88
Created April 30, 2025 12:29
Show Gist options
  • Save ZulX88/6f2a1da7920c73261f5df727209c6ea9 to your computer and use it in GitHub Desktop.
Save ZulX88/6f2a1da7920c73261f5df727209c6ea9 to your computer and use it in GitHub Desktop.
Facebook downloader
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