HACKER Q&A
📣 thiht

Can I filter submissions by domain TLD?


I’d like to filter the HN submissions where the provided URL ends in .fr, to find blogs or personal websites of Frenchies. Is that possible?

I tried the obvious /from?site=*.fr but it doesn’t seem to be available


  👤 gabrielsroka Accepted Answer ✓
https://hn.algolia.com/api/v1/search?query=.fr/&restrictSear...

Or https://hn.algolia.com/api/v1/search_by_date?query=.fr/&rest...

See restrictSearchableAttributes=url in https://hn.algolia.com/api

Then maybe some JavaScript:

   javascript:console.table(JSON.parse(document.body.innerText).hits.map(h => ({title: h.title, url: h.url, dt: h.created_at})))
The results aren't perfect. You could do more filtering on the client side.

👤 gus_massa
You can filter by domain, for example

https://news.ycombinator.com/from?site=bbc.co.uk

but each TLD/subdomain have a different level of granularity.

It would be nice that if

https://news.ycombinator.com/from?site=co.uk

https://news.ycombinator.com/from?site=uk

also work and include all the subdomains.

Try sending a feature request to the mods hn@ycombinator.com . (They usually reply very soon, but new features may take more time to be implemented, assuming they like them.)


👤 detaro