To scrape popular questions from Reddit, here’s a brief overview of how you can do it:
Method 1: Use Reddit’s API
Reddit offers a free API for accessing posts and comments.
Steps:
-
Create a Reddit App:
-
Create a script-type app to get a
client_idandclient_secret.
-
Use Python and PRAW (Python Reddit API Wrapper):
-
Filter for Questions Only:
-
Many popular subreddits like r/AskReddit, r/TooAfraidToAsk, or r/NoStupidQuestions are filled with question-style titles.
-
Method 2: Use Pushshift API (Unofficial)
Pushshift.io offers more advanced querying, including historical data.
Example:
-
Use this endpoint with filters to grab popular questions.
-
Note: Pushshift is less reliable for real-time data as it may lag behind Reddit’s official API.
Method 3: Use Web Scraping (If API is not an option)
Use libraries like BeautifulSoup with requests, or automation tools like Selenium.
Example with Python:
Note: Reddit may block automated scrapers. Use API if possible and respect their terms of service.
Would you like a ready-to-use script or list of currently trending questions pulled live?