Linkedin post scraper avatar

Linkedin post scraper

Try for free

3 days trial then $30.00/month - No credit card required now

Go to Store
Linkedin post scraper

Linkedin post scraper

curious_coder/linkedin-post-search-scraper
Try for free

3 days trial then $30.00/month - No credit card required now

Scrape linkedin posts or updates from linkedin post search results. Supports advanced linkedin search filters. Extract posts from any linkedin member

CS

Cookie Editor Chrome Extension vs Puppeteer Cookies

Closed

chinobi_seven opened this issue
2 months ago

Hi, I am currently working on using the post scraper programmatically in nodejs. In order to get cookie data, I am using Puppeteer to login into Linkedin and save my cookie data that is later converted into JSON. When I use that cookie data in my input, I am met with the following error:

"There was an uncaught exception during the run of the Actor and it was not handled."

However, when I use the Cookie Editor manually it works fine. When comparing both cookie outputs. I notice slight differences. Is there a specific format that the cookies need to be in in order for this to work?

curious_coder avatar

Yes there are some differences in cookie format between puppeteer and cookie-editor extension. For example, field name should be renamed to key when converting from puppeteer cookie. You can compare a sample cookie and make necessary changes

CS

chinobi_seven

2 months ago

Hi, I have worked to re-format what i am getting from Puppeteer and I am very stuck. I am getting the following error:

2024-11-01T19:33:06.317Z TypeError: Cannot read properties of undefined (reading 'startsWith') 2024-11-01T19:33:06.319Z at isSecurePrefixConditionMet (/usr/src/app/node_modules/tough-cookie/lib/cookie.js:650:22) 2024-11-01T19:33:06.321Z at CookieJar.setCookie (/usr/src/app/node_modules/tough-cookie/lib/cookie.js:1255:12) 2024-11-01T19:33:06.324Z at CookieJar.setCookie (/usr/src/app/node_modules/tough-cookie/node_modules/universalify/index.js:5:67) 2024-11-01T19:33:06.326Z at CookieJar.setCookieSync (/usr/src/app/node_modules/tough-cookie/lib/cookie.js:1728:17) 2024-11-01T19:33:06.328Z at file:///usr/src/app/src/helpers.js:54:9 2024-11-01T19:33:06.330Z at Array.forEach () 2024-11-01T19:33:06.332Z at Object.updateCookieJar (file:///usr/src/app/src/helpers.js:51:11) 2024-11-01T19:33:06.334Z at new Client (file:///usr/src/app/src/linkedin.js:20:21) 2024-11-01T19:33:06.337Z at file:///usr/src/app/src/main.js:79:16 2024-11-01T19:33:06.339Z at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Based on the following cookie format:

[ { "key": "__cf_bm", "value": "...", "domain": ".linkedin.com", "path": "/", "expires": 1730487049.232516, "secure": true, "httpOnly": true

1},
2{
3  "key": "lidc",
4  "value": "...",

... [trimmed]

curious_coder avatar

Sorry, it was my mistake, My previous advice was wrong.

Actual mistake is you've passed the cookies as array of stringified json cookies.

You should not stringify the individual cookie object inside arrays. Instead pass the cookie array as object of arrays and stringify the entire input the actor as JSON

CH

chuffed

4 days ago

Can I just ask, how does this work?

Is this dynamically updating the Cookies every day? Therefore does this avoid the Cookie issue?

curious_coder avatar

It doesn't update the cookies by itself.

Follow these steps to get the cookies:

  • Install Cookie-Editor chrome extension
  • Login to your facebook account
  • Click on the extension and export the cookies
  • Paste the copied cookies into input

Video - How to get cookies

Developer
Maintained by Community

Actor Metrics

  • 582 monthly users

  • 106 stars

  • 88% runs succeeded

  • 5 days response time

  • Created in Jun 2023

  • Modified 14 days ago