Internet |> 

Bibliography

With 70% of the internet still using jQuery, it’s unrealistic to expect website owners to label and provide all the content that could be useful to others. What if there were a record of how to find certain fields of interest - a bibliography for the internet, perhaps?

Contents

  1. Knowing what you can query beforehand
  2. Assigning new labels

Knowing what you can query before hand

Using our /bibliography endpoint you can query for fields that people have defined CSS selectors for by including either a title or url query parameter for the page you’re interested in looking up the bibliography for. Here’s what looks like to use fetch in order to get all available selectors on Hacker News:

fetch(
  `https://lsd.so/bibliography?url=${
    encodeURIComponent("https://news.ycombinator.com")
  }`
)

Or, if you prefer to see the cURL statement instead:

curl --url https://lsd.so/bibliography
     --data-urlencode "url=https://news.ycombinator.com"

Assigning new labels

Specifying what something is shouldn’t be necessary if you’ve already implicitly defined it in the past. When you run SQL statements like the following:

FROM https://news.ycombinator.com
|> GROUP BY span.titleline
|> SELECT a AS post;

In addition to labeling the column header as post in the results.

Screenshot of query results

The database will also know to set the SELECTing as well as GROUP BYing values to the bibliographical definition thereby making it accessible from the bibliography API. Shown is the response for the cURL statement above after running the Hacker News query for post:

[{"alias":"post","group_by":"span.titleline","selector":"a"}]