Lurker News

Comments (127) 31 threads

Earlier comments
lorey2 replies#
In case anyone wants to detect the selectors automatically, here's a small python library I wrote that does it for you: https://github.com/lorey/mlscraper
clickok1 reply#
A good idea and very cleanly implemented. I imagine that there's a ton of other possible applications that don't require much modification to the code. Thanks for sharing!
lorey#
Thank you so much, happy to hear! There's a more versatile version coming soon :)
kwerk1 reply#
This looks interesting! Will you be adding an open source license?
lorey#
Will do, just haven't decided yet :)
earthboundkid1 reply#
I made a thing like this once to scrape school websites to figure out if there was a snow day. I found that most schools have Twitter and it was simpler and faster to subscribe to Twitter for updates.
ianberdin1 reply#
My friend is working on a quite simple feed generator from any website, social media: https://rss.app. Maybe helpful.
zephyr91 reply#
Some feedback for the project, please reveal pricing/limits before signup.
goleary#
Agreed, they should show it before signup.

For anyone curious: Free - 2 RSS feeds 24 hour refresh rate $9.99 - 40 RSS feeds 30 min refresh rate $19.99 - 100 RSS feeds 15 min refresh rate
My company uses RSS.app & I find it extremely nice to work with. You don't even have to provide selectors/click on elements for the vast majority of websites, they do that all for you.
We could roll our own solution using any of the above offerings (or something built in house), but it's cheap enough for our usecase that we don't see a point.

peanutz4541 reply#
On a job website I wondered if I could use CSS selectors to get to the important stuff. I think a lot of people have had those thoughts, and the website knew. While the page might have some repeatable structure, the ids and classes were just randomly generated. Also, After you open the job listing, they too were all different because the job poster had the ability to set up their own mini html that was embedded in the page.
VoidWhisperer1 reply#
It is entirely possible that they did this to prevent scraping, but it is also possible it isn't intentional like that - for example, if you use the 'styled components' react library, it ends up spitting out a ton of class names that are basically gibberish, not intentionally.
k1m#
That's been my experience too, as well as encountering a lot of legacy HTML markup without many useful class/id attributes. The random values are likely result of modern build tools like the one you mention, but there's also the growing popularity of utility-first CSS frameworks like Tailwind which also make finding useful selectors difficult.

In these situations it might be best to rely on position of elements and other CSS selectors rather than attribute values. Unfortunately the :nth-child and :nth-of-type selectors still trip many people up. In Feed Creator we borrowed from XPath to make selecting by position a little easier. We've got a comparison here: https://help.fivefilters.org/feed-creator/css-selectors.html...

Load more comments