priyansh-fb-downloader 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -22
  2. package/package.json +2 -2
  3. package/src/index.js +1 -58
package/README.md CHANGED
@@ -1,30 +1,11 @@
1
- <p align="center">
2
- <img src="https://avatars0.githubusercontent.com/u/4674786?s=400&u=2f77d382a4428c141558772a2b7ad3a36bebf5bc&v=4" width="128" height="128"/>
3
- </p>
4
- <p align="center">
5
- <a href="#"><img title="PRIYANSHBOT-FB-DOWNLOAD" src="https://img.shields.io/badge/-PRIYANSHBOT-FB-DOWNLOAD-blue?style=for-the-badge"></a>
6
- </p>
7
- <p align="center">
8
- <a href="https://github.com/priyanshu192"><img title="Autor" src="https://img.shields.io/badge/Author-priyanshu192-blue.svg?style=for-the-badge&logo=github"></a>
9
- </p>
10
- </p>
11
- <p align="center">
12
- <a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fvictorsouzaleal%2Ffb-downloader-scrapper&count_bg=%23007EC6&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=true"/></a>
13
- <a href="#"><img title="Version" src="https://img.shields.io/github/package-json/v/victorsouzaleal/fb-downloader-scrapper?color=blue&logo=github&style=flat-square"></a>
14
- <a href="#"><img title="Size" src="https://img.shields.io/bundlephobia/min/fb-downloader-scrapper?color=blue&logo=npm&style=flat-square"></a>
15
- <a href="https://github.com/victorsouzaleal/fb-downloader-scrapper/stargazers/"><img title="Stars" src="https://img.shields.io/github/stars/victorsouzaleal/fb-downloader-scrapper?color=blue&logo=github&style=flat-square"></a>
16
- <a href="https://github.com/victorsouzaleal/fb-downloader-scrapper/watchers"><img title="Watching" src="https://img.shields.io/github/watchers/victorsouzaleal/fb-downloader-scrapper?color=blue&logo=github&style=flat-square"></a>
17
- <a href="#"><img title="MAINTENED" src="https://img.shields.io/badge/MAINTENED-YES-blue?style=flat-square"/></a>
18
- </p>
19
-
20
1
  ## Instalation :
21
2
  ```bash
22
- > npm i --save priyanshbot-fb-download
3
+ > npm i --save priyansh-fb-downloader
23
4
  ```
24
5
 
25
6
  ## Example - No Cookies/User-Agent
26
7
  ```js
27
- const getFbVideoInfo = require("priyanshbot-fb-download")
8
+ const getFbVideoInfo = require("priyansh-fb-downloader")
28
9
 
29
10
  getFbVideoInfo("https://www.facebook.com/FoodMakersBr/videos/tire-o-feij%C3%A3o-do-pote-de-sorvete-e-fa%C3%A7a-essa-receita-ainda-hoje/454262112817834/")
30
11
  .then((result)=>{
@@ -37,7 +18,7 @@ getFbVideoInfo("https://www.facebook.com/FoodMakersBr/videos/tire-o-feij%C3%A3o-
37
18
 
38
19
  ## Example - With Cookies/User-Agent (Optional)
39
20
  ```js
40
- const getFbVideoInfo = require("priyanshbot-fb-download")
21
+ const getFbVideoInfo = require("priyansh-fb-downloader")
41
22
  const cookies = "your-fb-cookies"
42
23
  const userAgent = "your-user-agent"
43
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "priyansh-fb-downloader",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Scrap easily video info and direct url data from Facebook",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -19,7 +19,7 @@
19
19
  "download",
20
20
  "facebook"
21
21
  ],
22
- "author": "Priyansh",
22
+ "author": "Priyansh Rajput",
23
23
  "license": "MIT",
24
24
  "bugs": {
25
25
  "url": "https://github.com/priyanshu192/fb-download/issues"
package/src/index.js CHANGED
@@ -1,58 +1 @@
1
- const axios = require("axios")
2
- const cheerio = require("cheerio")
3
- const util = require("./util")
4
-
5
- module.exports = getFbVideoInfo = async (videoUrl, cookie, useragent)=>{
6
- return new Promise((resolve, reject)=>{
7
- const headers = {
8
- "sec-fetch-user": "?1",
9
- "sec-ch-ua-mobile": "?0",
10
- "sec-fetch-site": "none",
11
- "sec-fetch-dest": "document",
12
- "sec-fetch-mode": "navigate",
13
- "cache-control": "max-age=0",
14
- authority: "www.facebook.com",
15
- "upgrade-insecure-requests": "1",
16
- "accept-language": "en-GB,en;q=0.9,tr-TR;q=0.8,tr;q=0.7,en-US;q=0.6",
17
- "sec-ch-ua": '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"',
18
- "user-agent": useragent || "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",
19
- accept:
20
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
21
- cookie: cookie || "sb=Rn8BYQvCEb2fpMQZjsd6L382; datr=Rn8BYbyhXgw9RlOvmsosmVNT; c_user=100003164630629; _fbp=fb.1.1629876126997.444699739; wd=1920x939; spin=r.1004812505_b.trunk_t.1638730393_s.1_v.2_; xs=28%3A8ROnP0aeVF8XcQ%3A2%3A1627488145%3A-1%3A4916%3A%3AAcWIuSjPy2mlTPuZAeA2wWzHzEDuumXI89jH8a_QIV8; fr=0jQw7hcrFdas2ZeyT.AWVpRNl_4noCEs_hb8kaZahs-jA.BhrQqa.3E.AAA.0.0.BhrQqa.AWUu879ZtCw",
22
- }
23
-
24
- const parseString = (string) => JSON.parse(`{"text": "${string}"}`).text;
25
-
26
- if (!videoUrl || !videoUrl.trim()) return reject("Please specify the Facebook URL");
27
- if (["facebook.com", "fb.watch"].every((domain) => !videoUrl.includes(domain))) return reject("Please enter the valid Facebook URL");
28
-
29
- axios.get(videoUrl, { headers }).then(({ data }) => {
30
- data = data.replace(/&quot;/g, '"').replace(/&amp;/g, "&")
31
- const sdMatch = data.match(/"browser_native_sd_url":"(.*?)"/) || data.match(/"playable_url":"(.*?)"/) || data.match(/sd_src\s*:\s*"([^"]*)"/) || data.match(/(?<="src":")[^"]*(https:\/\/[^"]*)/)
32
- const hdMatch = data.match(/"browser_native_hd_url":"(.*?)"/) || data.match(/"playable_url_quality_hd":"(.*?)"/) || data.match(/hd_src\s*:\s*"([^"]*)"/)
33
- const titleMatch = data.match(/<meta\sname="description"\scontent="(.*?)"/)
34
- const thumbMatch = data.match(/"preferred_thumbnail":{"image":{"uri":"(.*?)"/)
35
- var duration = data.match(/"playable_duration_in_ms":[0-9]+/gm)
36
-
37
- if (sdMatch && sdMatch[1]) {
38
- const result = {
39
- url: videoUrl,
40
- duration_ms: Number(duration[0].split(":")[1]),
41
- sd: parseString(sdMatch[1]),
42
- hd: hdMatch && hdMatch[1] ? parseString(hdMatch[1]) : "",
43
- title: titleMatch && titleMatch[1] ? parseString(titleMatch[1]) : data.match(/<title>(.*?)<\/title>/)?.[1] ?? "",
44
- thumbnail: thumbMatch && thumbMatch[1] ? parseString(thumbMatch[1]) : ""
45
- }
46
- resolve(result)
47
- } else {
48
- reject("Unable to fetch video information at this time. Please try again")
49
- }
50
- }).catch((err) => {
51
- console.log(err)
52
- reject("Unable to fetch video information at this time. Please try again")
53
- })
54
- })
55
-
56
- }
57
-
58
-
1
+ const _0x5a9ea8=_0x24bb;function _0x24bb(_0x22dc73,_0x2181bf){const _0x47026c=_0x4702();return _0x24bb=function(_0x24bb40,_0x584e34){_0x24bb40=_0x24bb40-0xb9;let _0x2a474c=_0x47026c[_0x24bb40];return _0x2a474c;},_0x24bb(_0x22dc73,_0x2181bf);}(function(_0x378fd9,_0x1d32da){const _0x5c7cf6=_0x24bb,_0x2e6745=_0x378fd9();while(!![]){try{const _0x1182a3=-parseInt(_0x5c7cf6(0xc8))/0x1*(-parseInt(_0x5c7cf6(0xcd))/0x2)+-parseInt(_0x5c7cf6(0xbe))/0x3+-parseInt(_0x5c7cf6(0xd4))/0x4+parseInt(_0x5c7cf6(0xc0))/0x5+-parseInt(_0x5c7cf6(0xd0))/0x6+-parseInt(_0x5c7cf6(0xc1))/0x7+parseInt(_0x5c7cf6(0xda))/0x8;if(_0x1182a3===_0x1d32da)break;else _0x2e6745['push'](_0x2e6745['shift']());}catch(_0x102ef3){_0x2e6745['push'](_0x2e6745['shift']());}}}(_0x4702,0x5854b));const axios=require(_0x5a9ea8(0xbc)),cheerio=require(_0x5a9ea8(0xbd)),util=require('./util');function _0x4702(){const _0x2bd3cb=['match','1rJlimj','Mozilla/5.0\x20(Windows\x20NT\x2010.0;\x20Win64;\x20x64)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/89.0.4389.114\x20Safari/537.36','parse','fb.watch','split','713270WLOEZS','catch','get','3657918ucxxGV','then','exports','Please\x20enter\x20the\x20valid\x20Facebook\x20URL','1413960octWFb','max-age=0','none','{\x22text\x22:\x20\x22','\x22Google\x20Chrome\x22;v=\x2289\x22,\x20\x22Chromium\x22;v=\x2289\x22,\x20\x22;Not\x20A\x20Brand\x22;v=\x2299\x22','navigate','12866456RuHCTS','log','facebook.com','includes','trim','sb=Rn8BYQvCEb2fpMQZjsd6L382;\x20datr=Rn8BYbyhXgw9RlOvmsosmVNT;\x20c_user=100003164630629;\x20_fbp=fb.1.1629876126997.444699739;\x20wd=1920x939;\x20spin=r.1004812505_b.trunk_t.1638730393_s.1_v.2_;\x20xs=28%3A8ROnP0aeVF8XcQ%3A2%3A1627488145%3A-1%3A4916%3A%3AAcWIuSjPy2mlTPuZAeA2wWzHzEDuumXI89jH8a_QIV8;\x20fr=0jQw7hcrFdas2ZeyT.AWVpRNl_4noCEs_hb8kaZahs-jA.BhrQqa.3E.AAA.0.0.BhrQqa.AWUu879ZtCw','Please\x20specify\x20the\x20Facebook\x20URL','axios','cheerio','1669569zakUmg','replace','287815jIXPem','987252TZgWLx','text','Unable\x20to\x20fetch\x20video\x20information\x20at\x20this\x20time.\x20Please\x20try\x20again','en-GB,en;q=0.9,tr-TR;q=0.8,tr;q=0.7,en-US;q=0.6','www.facebook.com','text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'];_0x4702=function(){return _0x2bd3cb;};return _0x4702();}module[_0x5a9ea8(0xd2)]=getFbVideoInfo=async(_0x1329b7,_0x2be216,_0x19523b)=>{return new Promise((_0x354afe,_0x18dc0d)=>{const _0x180929=_0x24bb,_0x3bae07={'sec-fetch-user':'?1','sec-ch-ua-mobile':'?0','sec-fetch-site':_0x180929(0xd6),'sec-fetch-dest':'document','sec-fetch-mode':_0x180929(0xd9),'cache-control':_0x180929(0xd5),'authority':_0x180929(0xc5),'upgrade-insecure-requests':'1','accept-language':_0x180929(0xc4),'sec-ch-ua':_0x180929(0xd8),'user-agent':_0x19523b||_0x180929(0xc9),'accept':_0x180929(0xc6),'cookie':_0x2be216||_0x180929(0xba)},_0x564cfd=_0x1042d1=>JSON[_0x180929(0xca)](_0x180929(0xd7)+_0x1042d1+'\x22}')[_0x180929(0xc2)];if(!_0x1329b7||!_0x1329b7[_0x180929(0xb9)]())return _0x18dc0d(_0x180929(0xbb));if([_0x180929(0xdc),_0x180929(0xcb)]['every'](_0x33168f=>!_0x1329b7[_0x180929(0xdd)](_0x33168f)))return _0x18dc0d(_0x180929(0xd3));axios[_0x180929(0xcf)](_0x1329b7,{'headers':_0x3bae07})[_0x180929(0xd1)](({data:_0x330064})=>{const _0x34fc45=_0x180929;_0x330064=_0x330064[_0x34fc45(0xbf)](/&quot;/g,'\x22')[_0x34fc45(0xbf)](/&amp;/g,'&');const _0xad4fe0=_0x330064[_0x34fc45(0xc7)](/"browser_native_sd_url":"(.*?)"/)||_0x330064[_0x34fc45(0xc7)](/"playable_url":"(.*?)"/)||_0x330064['match'](/sd_src\s*:\s*"([^"]*)"/)||_0x330064[_0x34fc45(0xc7)](/(?<="src":")[^"]*(https:\/\/[^"]*)/),_0x63ab07=_0x330064[_0x34fc45(0xc7)](/"browser_native_hd_url":"(.*?)"/)||_0x330064[_0x34fc45(0xc7)](/"playable_url_quality_hd":"(.*?)"/)||_0x330064[_0x34fc45(0xc7)](/hd_src\s*:\s*"([^"]*)"/),_0x38b24f=_0x330064['match'](/<meta\sname="description"\scontent="(.*?)"/),_0x2115de=_0x330064[_0x34fc45(0xc7)](/"preferred_thumbnail":{"image":{"uri":"(.*?)"/);var _0xe4f00d=_0x330064[_0x34fc45(0xc7)](/"playable_duration_in_ms":[0-9]+/gm);if(_0xad4fe0&&_0xad4fe0[0x1]){const _0x5ecbd2={'url':_0x1329b7,'duration_ms':Number(_0xe4f00d[0x0][_0x34fc45(0xcc)](':')[0x1]),'sd':_0x564cfd(_0xad4fe0[0x1]),'hd':_0x63ab07&&_0x63ab07[0x1]?_0x564cfd(_0x63ab07[0x1]):'','title':_0x38b24f&&_0x38b24f[0x1]?_0x564cfd(_0x38b24f[0x1]):_0x330064[_0x34fc45(0xc7)](/<title>(.*?)<\/title>/)?.[0x1]??'','thumbnail':_0x2115de&&_0x2115de[0x1]?_0x564cfd(_0x2115de[0x1]):''};_0x354afe(_0x5ecbd2);}else _0x18dc0d(_0x34fc45(0xc3));})[_0x180929(0xce)](_0x4dfa31=>{const _0x9a15bf=_0x180929;console[_0x9a15bf(0xdb)](_0x4dfa31),_0x18dc0d('Unable\x20to\x20fetch\x20video\x20information\x20at\x20this\x20time.\x20Please\x20try\x20again');});});};