9

i am using selenium chrome driver to scratch Linkedin's profile. I am doing analysis for my post. It is the way to get exact date from Linkedin's post in format "dd.mm.yyyy" instead of "1 month ago", "2 weeks ago"?

Please help, Jacek

Jacek Antek
  • 177
  • 1
  • 2
  • 10
  • 1
    https://stackoverflow.com/questions/127803/how-do-i-parse-an-iso-8601-formatted-date this might help you – Amruta Aug 24 '20 at 05:14
  • 1
    As There is no information in the HTML of post regarding post date. I afraid you can get exact date. However based on information present there like 1 mo. , 2 Week you can do calculations and get **approx date** by subtracting from current system date. – rahul rai Aug 24 '20 at 05:30
  • Thank you Guys! The first link i do not know if it is on topic – Jacek Antek Aug 24 '20 at 06:13

2 Answers2

27

I decoded the post id to find the timestamp. Method and (js) code here: https://github.com/Ollie-Boyd/Linkedin-post-timestamp-extractor.

From the 19 digit Linkedin post ID (after some trial and error) I found we can convert the post ID to binary, then convert the first 41 binary bits to a decimal to give the UNIX timestamp in milliseconds.

Ollie Boyd
  • 271
  • 3
  • 4
  • How to make it work on job post url? The job post id is 10 digits not 19. – Dawei Xu Aug 22 '22 at 05:30
  • 1
    Hi @DaweiXu , I had a look at the job post ID and I'm not sure there's a datetime contained within it. There could be, but I think it might be a database ID etc – Ollie Boyd Aug 24 '22 at 11:27
  • 3
    https://ollie-boyd.github.io/Linkedin-post-timestamp-extractor/ is the location of a working demo of the form. Thanks! – Ryan Jan 31 '23 at 15:06
0

Not really, if you check the html you will see that you have a basic string:

enter image description here

The only workaround for your problem is to create a method:

  1. Extract the current date (formatted as desired)
  2. Extract from LI how much time passed
  3. Create your logic based on extracted data (for hours, days, weeks, months, years) and do the math with your extracted current date. This one shouldn't be too difficult since any programming language has libraries to help you.
Razvan
  • 347
  • 1
  • 11