4

I am just exploring the SE sites. When I click on one of them it shows statistics about questions/answers with one question with a link. For Stack Overflow, this is the question:

Enter image description here

How is a question selected?

  • Based on popular tags
  • From Hot Tab
  • Based on upvotes a question receives
  • Based on views
  • How frequently question is changed
1

1 Answer 1

5

The question is selected from the hot network questions list; you can see this in the POST request made for each card you click on:

  • URL: https://stackexchange.com/sites/card-data
  • Method: POST
  • Parameters:
    • siteId: 1
    • fetchTopUsers: true
    • fetchHotQuestion: true
  • Response content type: JSON, object with hotQuestionHtml and topUsersHtml keys.

E.g., with a little Python code we can fetch the HTML snippet and get the title:

>>> card = requests.post("https://stackexchange.com/sites/card-data", data={"siteId": 1, "fetchTopUsers": "true", "fetchHotQuestion": "true"}).json()
>>> from bs4 import BeautifulSoup
>>> print(BeautifulSoup(card["hotQuestionHtml"]).a.string)
“Why can't I get the argument count of a template function at compile-time?”

This is the most recent hot network question for Stack Overflow.

You can verify this by requesting the Hot Network Questions, filtering the JSON response (a list of objects) on the site name, and picking the most recent result as indicated by the creation_date field:

>>> import requests
>>> from datetime import datetime
>>> data = requests.get("https://stackexchange.com/hot-questions-for-mobile").json()
>>> so = [d for d in data if d['site'] == 'stackoverflow.com']
>>> top = max(so, key=lambda d: d['creation_date'])
>>> print(top['title'])
Why can't I get the argument count of a template function at compile-time?

The HNQ list is limited to 100 questions so not every site is listed in it, but that limit is artificial. For example, Server Fault currently doesn't have a post in the HNQ listed but the one on the card probably would make the cut if the limit was raised; its hotness score just doesn't make the grade. In this case, the score is pretty low, so there are basically no 'better' candidates on Server Fault right now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .