Hacker News new | ask | show | jobs
Show HN: This blog post shows its Hacker News score (blog.var.so)
19 points by xelia 1059 days ago
3 comments

Just tried it and worked almost immediately with the counter update! Nice.
The design for the upvote count looks great!
Thank you!
It's probably against their TOS, but you could always glom onto the search from https://hh.algolia.com

Insomnia generated query:

  const options = {
    method: 'POST',
    body: '{"query":"blog.var.so/hnvotes","analyticsTags":["web"],"page":0,"hitsPerPage":30,"minWordSizefor1Typo":4,"minWordSizefor2Typos":8,"advancedSyntax":true,"ignorePlurals":false,"clickAnalytics":true,"minProximity":7,"numericFilters":[],"tagFilters":["story",[]],"typoTolerance":true,"queryType":"prefixLast","restrictSearchableAttributes":["title","comment_text","url","story_text","author"],"getRankingInfo":true}'
  };

  fetch('https://uj5wyc0l7x-dsn.algolia.net/1/indexes/Item_production/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.0.2)%3B%20Browser%20(lite)&x-algolia-api-key=8ece23f8eb07cd25d40262a1764599b1&x-algolia-application-id=UJ5WYC0L7X', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
Response:

   {
   "hits": [
   {
    "created_at": "2023-07-29T09:29:26.000Z",
    "title": "Show HN: This blog post shows its Hacker News score",
    "url": "https://blog.var.so/hnvotes",
    "author": "xelia",
    "points": 4,
    "story_text": null,
    "comment_text": null,
    "num_comments": 0,
    "story_id": null,
    "story_title": null,
    "story_url": null,
    "parent_id": null,
    "created_at_i": 1690622966,
    "_tags": [
     "story",
     "author_xelia",
     "story_36918440",
     "show_hn"
    ],
    "objectID": "36918440",
    "_highlightResult": {
     "title": {
      "value": "Show HN: This blog post shows its Hacker  News score",
      "matchLevel": "none",
      "matchedWords": []
     },
     "url": {
      "value":  "https://<em>blog.var.so</em>/<em>hnvotes</em>",
      "matchLevel": "full",
      "fullyHighlighted": true,
      "matchedWords": [
       "blog",
       ".",
       "var",
       ".",
       "so",
       "hnvotes"
      ]
     },
     "author": {
      "value": "xelia",
      "matchLevel": "none",
      "matchedWords": []
     }
    },
    "_rankingInfo": {"..."}
  }
 ],
 "nbHits": 1,
 "page": 0,
 "nbPages": 1,
 "hitsPerPage": 30,
 "exhaustiveNbHits": false,
 "exhaustiveTypo": false,
 "exhaustive": {
  "nbHits": false,
  "typo": false
 },
 "query": "blog.var.so/hnvotes",
 "params": "..."
 "queryID": "6ca1c94fa4928783a82328ca57bd19ba",
 "serverUsed": "d9-ca-1.algolia.net",
 "indexUsed": "Item_production",
 "parsedQuery": "\"blog . var . so\" hnvotes",
 "timeoutCounts": false,
 "timeoutHits": false,
 "processingTimeMS": 9,
 "processingTimingsMS": {
  "fetch": {
   "query": 8,
   "total": 8
  },
  "request": {
   "roundTrip": 13
  },
  "total": 9
 },
 "serverTimeMS": 9
  }
EDIT: Fix formatting
That's really cool, will definitely consider, thanks!