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

185
Views
imagen de raspado web de pinterest

Estoy tratando de obtener una url de una imagen de pinterest y enviar una url a través del perfil general del usuario en pinterest, pero me devuelve indefinido

ingrese la descripción de la imagen aquí

mi código:

 const Command = require("../../structures/Command"); const cheerio = require("cheerio"); const rp = require("request-promise"); const { head } = require("request"); module.exports = class Pinterest extends Command { constructor(client) { super(client); this.client = client; this.name = "pinterest"; this.category = "Dono"; this.aliases = []; this.enabled = true; this.guildOnly = true; } async run({ message, args, prefix, author }, t) { if ( message.author.id !== "196679829800747017" ) return; const URL = (`https://br.pinterest.com/n1cotin3/_created/`) const headerObj = { uri: URL }; rp(headerObj) .then(html => { var $ = cheerio.load(html) const avatar = $("#mweb-unauth-container > div > div:nth-child(2) > div:nth-child(3) > div.F6l.ZZS.k1A.zI7.iyn.Hsu > div > div > div > div:nth-child(1) > div:nth-child(1) > div > div > div > div > div > a > div > div > div > div > div.XiG.zI7.iyn.Hsu > img").attr("src") console.log(avatar) message.react(`💥`); }) } };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El problema es que la página sigue cargando. #mweb-unauth-container > div > div:nth-child(2) no existe, porque #mweb-unauth-container > div solo tiene un div child, y es un icono de carga. No creo que esto sea algo que puedas hacer con cheerio, tendrás que usar una alternativa que pueda resolver Javascript (como Puppeteer).

Alternativamente, si no desea raspar, puede usar una API privada (que, aunque está sujeta a cambios en cualquier momento, definitivamente sería más eficiente):

https://widgets.pinterest.com/v3/pidgets/users/n1cotin3/pins/

Ejemplo:

 const res = await requestThatEnpointSomehow(); const images = res.data.pins.map(({ images }) => images['564x']); // `images` will be a list of URLs.
about 4 years ago · Juan Pablo Isaza Report
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!