Home > Mobile >  pinterest web scrape image
pinterest web scrape image

Time:05-02

I'm trying to get a url from a pinterest image and send a url of it through the general profile of the user on pinterest, but it's returning me undefined

enter image description here

my code:

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(`           
  • Related