Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // base https://fdown.net/
- const fbvdl = async (urlFesnuk) => {
- const r = await fetch(`https://fdown.net/download.php`, {
- headers: {
- "content-type": "application/x-www-form-urlencoded",
- },
- body: new URLSearchParams({
- URLz: urlFesnuk
- }),
- method : "post"
- })
- if (!r.ok) throw Error (`${r.status} ${r.statusText} ${(await r.text() || `(respond body kosong)`).substring(0,100)}`)
- const html = await r.text()
- const hd = html.match(/id="hdlink" href="(.+?)" download/)?.[1]?.replaceAll("&","&")
- const sd = html.match(/id="sdlink" href="(.+?)" download/)?.[1]?.replaceAll("&","&")
- if (!hd&&!sd) throw Error (`tidak ada video yang bisa di download`)
- const result = {hd,sd}
- return result
- }
- // cara pakai
- fbvdl('https://web.facebook.com/watch?v=1018693590342239')
- .then(console.log)
- .catch(console.log)
- /* outpput
- {
- hd: 'https://video-lax3-2.xx.fbcdn......h_h264-basic-gen2_720p&dl=1',
- sd: 'https://video-lax3-1.xx.fbcdn.net/o.....&bitrate=211631&tag=sve_sd&dl=1'
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment