spinlud / linkedin-jobs-scraper

147 stars 40 forks source link

Scrap company IMG url #33

Closed calvinomiguel closed 2 years ago

calvinomiguel commented 2 years ago

This is not a bug, but a feature request. It' be great to be able to get the img of company's profile.

Thank you so much for this tool!

spinlud commented 2 years ago

Hi there, in version 11.1.0 a companyImgLink field has been added which points to the company media logo. Give it a go and let me know!

calvinomiguel commented 2 years ago

Unfortunatelly this one it's not working. the object property companyImgLink is returning nothing.

spinlud commented 2 years ago

Seems to work fine here

image

calvinomiguel commented 2 years ago

That's weird. Can you show me thw rest of your code?

calvinomiguel commented 2 years ago

I've reinstalled the setup 3 times already. Still no companyImg. Not sure what's going on. When I log the data object, there is no companyImgLink property to be seen. This is what I get:

grafik
spinlud commented 2 years ago

Please make sure you are running with authenticated session (coookie set). Anonymous session is no longer supported.

This is a sample code I have just tested:

const {
    LinkedinScraper,
    events,
} = require("linkedin-jobs-scraper");

(async () => {
    const scraper = new LinkedinScraper({
        headless: true,
        slowMo: 200,
        args: [
            "--lang=en-GB",
        ],
    });

    // Add listeners for scraper events
    scraper.on(events.scraper.data, (data) => {
        console.log(
            `Id='${data.jobId}'`,
            `Title='${data.title}'`,
            `Place='${data.place}'`,
            `Company='${data.company ? data.company : "N/A"}'`,
            `Location='${data.location}'`,
            `Link='${data.link}'`,
            `CompanyLink='${data.companyLink ? data.companyLink : "N/A"}'`,
            `CompanyImgLink='${data.companyImgLink ? data.companyImgLink : "N/A"}'`,
        );
        console.log('------------------------------------------------------------------------------');
    });

    await Promise.all([
        scraper.run([
            {
                query: "Engineer",
                options: {
                    limit: 10,
                    optimize: false,
                    locations: ["United States"],
                }
            }
        ])
    ]);

    await scraper.close();
})();

image

calvinomiguel commented 2 years ago

I'm pretty sure, I am using a cookie, but I'll try later again. Thanks for the clue ;-)