Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

276
Views
cómo obtener fbId de cualquier página fb en nodejs

Estoy tratando de obtener el fbid del perfil de nuestro usuario para generar el fb://page/fbid

a continuación, he adjuntado mi función findFacebookId () para obtener el fbid y funciona para todas las URL de la página FB, excepto que la URL está en mayúsculas

por ejemplo

https://www.facebook.com/userpage - findFacebookId() devuelve el fbId para esta URL

https://www.facebook.com/UserPage - findFacebookId() no funcionará para esta URL

Nota: en mi terminal local no solicita iniciar sesión, pero cuando ejecuto esta función en mi servidor ubuntu, solicita iniciar sesión

 findFacebookId: (name,cb) => { const curl = new (require('curl-request'))(); return new Promise((resolve, reject) => { let url = `https://www.facebook.com/${name}`; curl.setHeaders([ 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36' ]).get(url) .then(({ statusCode, body, headers }) => { var regularExpresionMatch = /fb:\/\/(group|page|profile)\/(\d{1,})/gi; const matches = body.match(regularExpresionMatch) const oldmatches = body.match(/entity_id":"\d*/i); if (matches && matches.length > 0) { const id = matches[0]; cb(null,id); return; } else { cb(true) } }) .catch((e) => { cb(e); }); }); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!