$ ls contents
In order to make the web more programmable, we're tackling the wasted time that'd go into scrolling around devtools and inspect element to figure out what selectors to use for particular labels. We have an API to make answering that question simple
To get the labeled CSS selectors/containers available for a given URL simply make a fetch request to our /aliases endpoint with the URL specified in the url query parameter
$ curl https://lsd.so/aliases?url=https%3A%2F%2Fnews.ycombinator.com
fetch(
`https://lsd.so/aliases?url=${
encodeURIComponent(
"https://news.ycombinator.com"
)
}`
).then(res => res.json()).then(data => console.log(data));
This returns a list of CSS selectors and container elements like so
[{"selector":"a","group_by":"span.titleline","alias":"posts","url":"https://news.ycombinator.com"},{"selector":"a","group_by":"span.titleline","alias":"title","url":"https://news.ycombinator.com"},{"selector":"a","group_by":"span.titleline","alias":"a","url":"https://news.ycombinator.com"},{"selector":"span.sitestr","group_by":"span.titleline","alias":"link","url":"https://news.ycombinator.com"},{"selector":"a","group_by":"span.titleline","alias":"post","url":"https://news.ycombinator.com"}]
With the value at the selector key containing the CSS selector for obtaining the element with relevant alias. For example, the above contains the object outlining information for getting the field that someone'd refer to as a "post"
[{"selector":"a","group_by":"span.titleline","alias":"post","url":"https://news.ycombinator.com"}]