medialab / SearchEnginesBookmarklet

Extract list of results from search engines pages as CSV with a bookmarklet directly within the browser
https://medialab.github.io/SearchEnginesBookmarklet/
GNU General Public License v3.0
18 stars 2 forks source link

Parse and convert moment dates #11

Closed boogheta closed 4 years ago

boogheta commented 4 years ago

Dates provided in google search use moment.js or similar technology resulting in some dates such as "Il y a 4 jours", "3 weeks ago". It would be nice to be able to parse these and revert to actual iso dates

Ideas towards this can be found here: https://stackoverflow.com/questions/16754882/moment-js-reverse-fromnow But handling locales is going to be complex, we need to find how to download and include in the page both moment.js and the desired corresponding locale and to adapt the regexp (maybe just (\d+)\s+(\w+) could suffice)

@Yomguithereal any experience doing this?

Yomguithereal commented 4 years ago

There are some helpers to easily inject some libraries when using artoo that could help indeed. I guess the "real" numeric date is not hidden somewhere in the html itself or in RAM?

boogheta commented 4 years ago

Nope, of course the real date is not int the html, haven't looked for residual var in ram though but I think it's actually processed serverside before the page is rendered