
Hacker News Has a Free Search API — Here's How to Use It
Hacker News has a powerful search API powered by Algolia. No authentication, no rate limits, instant results. Search Stories curl 'https://hn.algolia.com/api/v1/search?query=web+scraping&tags=story&hitsPerPage=5' Returns: title, points, comments, author, URL, date. Search by Date # Stories from the last 24 hours curl 'https://hn.algolia.com/api/v1/search_by_date?query=AI&tags=story&numericFilters=created_at_i>1711000000' Node.js Example async function searchHN ( query , limit = 25 ) { const url = `https://hn.algolia.com/api/v1/search?query= ${ encodeURIComponent ( query )} &tags=story&hitsPerPage= ${ limit } ` ; const res = await fetch ( url ); const data = await res . json (); return data . hits . map ( hit => ({ title : hit . title , url : hit . url , points : hit . points , comments : hit . num_comments , author : hit . author , date : hit . created_at , hn_url : `https://news.ycombinator.com/item?id= ${ hit . objectID } ` })); } const stories = await searchHN ( ' startup funding '
Continue reading on Dev.to Tutorial
Opens in a new tab



