- Find the epoch seconds 24 hours ago and a week ago (168 hours).
- For each of the list of tags you have, make two GET requests to
/questions
(to get both questions asked this day and this week). You should supply these parameters:
filter
(see one of my other answers). You'll need to include total
in the .wrapper
object and exclude items
.
tagged
- the tag you want
fromdate
- epoch seconds a day/week ago
- Look for the
total
property of the JSON returned. It might differ from the count shown on the site because the latter is cached.
Here's an example in Python using StackAPI (docs):
from datetime import datetime, timedelta
from stackapi import StackAPI
now = datetime.now()
last_day = now - timedelta(days = 1)
last_week = now - timedelta(weeks = 1)
last_day_secs = int(last_day.timestamp())
last_week_secs = int(last_week.timestamp())
# replace accordingly
tags = [ "javascript", "python", "java", "c#" ]
SITE = StackAPI("stackoverflow")
# exclude items, include the "total" property of .wrapper
q_filter = "!-)5fGp*dqmLp"
def fetch_q_total(fromdate, tag):
questions = SITE.fetch("questions",
tagged = tag,
fromdate = fromdate,
filter = q_filter)
return questions["total"]
for tag in tags:
q_day_total = fetch_q_total(last_day_secs, tag)
q_week_total = fetch_q_total(last_week_secs, tag)
print(f"{q_day_total} {tag} questions were posted in the last 24 hours")
print(f"{q_week_total} {tag} questions were posted in the last week")