Skip to content

How to automate gathering data from Stack Overflow? #612

Discussion options

You must be logged in to vote

Hi, @grahamj89

To automate gathering data from Stack Overflow, you can use the Stack Exchange API, specifically the /questions endpoint, to track top-voted questions for a particular tag. Below is a basic Python script using the requests library to pull data and track the most upvoted questions.

  1. Install the requests library if you don't have it already:
pip install requests
  1. Script to gather data:
import requests
import json
import time

# Function to fetch top-voted questions for a specific tag
def fetch_top_voted_questions(tag, pages=1):
    # URL of the Stack Exchange API for questions with a specific tag
    url = f'https://api.stackexchange.com/2.3/questions'
    
    questions =

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by grahamj89
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
None yet
2 participants