The Reddit Scraper is an advanced tool designed to extract and organize content from one of the world's largest online discussion platforms. This powerful scraper offers an efficient method to collect posts, comments, user data, and community metrics, providing valuable insights for various industries and applications.
Data Point | Description | Example |
---|---|---|
Post/Comment ID | Unique identifier for content | t1_k0vd12f |
User Information | Username of content creator | Ape***iht*** |
Content | Text of post or comment | [Full text content] |
Timestamp | Date and time of posting | 2023-09-16T18:32:01.006Z |
Engagement Metrics | Upvotes, replies, etc. | 2 upvotes, 0 replies |
Community Data | Subreddit information | Name, description, member count |
Content Attributes | Various flags and statuses | Is pinned, is NSFW, etc. |
The Reddit Scraper is a valuable asset for various sectors, including:
The Reddit Scraper API allows you to extract various types of information from Reddit, including comments, posts, and subreddit data. This powerful tool enables developers to integrate Reddit content into their applications for social media analysis, trend monitoring, and more.
To use the Reddit Scraper API, you'll need to authenticate your requests using your API key. The API provides several endpoints for retrieving different types of information:
Include your API key in the request headers:
Authorization: Bearer YOUR_API_KEY
The request body should be a JSON object with the following structure:
// For comments and posts endpoints
{
"url": "https://www.reddit.com/r/subreddit/comments/post_id/post_title/"
}
// For posts-by-subreddit endpoint
{
"url": "https://www.reddit.com/r/subreddit/"
}
// For posts-by-keyword endpoint
{
"keyword": "search term"
}
Please note that usage is subject to rate limiting. Refer to your plan details for specific limits.
Here's an example of the data you can expect to receive for the comments endpoint:
[
{
"input": {
"url": "https://www.reddit.com/r/ycombinator/comments/1fgmmcm/how_much_money_do_you_spend_out_of_pocket_on_your/",
"days_back": 10
},
"url": "https://www.reddit.com/r/ycombinator/comments/1fgmmcm/comment/ln34w75/",
"comment_id": "t1_ln34w75",
"user_posted": "Robert_Ant",
"comment": "I'm 23 and so far i've spent all my savings of $55k and am in debt ~$50k. I've been building for the last 9 months and i'm confident i'll get funded in the next 3-6mo",
"date_posted": "2024-09-14T14:21:22.554Z",
"post_url": "https://www.reddit.com/r/ycombinator/comments/1fgmmcm/how_much_money_do_you_spend_out_of_pocket_on_your/",
"post_id": "t3_1fgmmcm",
"community_name": "ycombinator",
"community_url": "https://www.reddit.com/r/ycombinator",
"community_description": "News and discussion around Y Combinator and Y Combinator companies.\n\nIn 2005, Y Combinator created a new model for funding early stage startups. Twice a year we invest a small amount of money in a large number of startups.",
"community_members_num": "65825",
"community_rank": {
"community_rank_type": "Rank by size",
"community_rank_value": "Top 2%"
},
"replies": [
{
"reply_id": "t1_ln3iuq3",
"user_replying": "soforchunet",
"user_url": "https://www.reddit.com/user/soforchunet/",
"reply": "Let me know if you need help with distribution! I'm in YC now (F24) and specifically help marketplaces with distribution. So it's kinda funny we're here!",
"date_of_reply": "2024-09-14T15:40:33.145Z",
"num_replies": null,
"num_upvotes": 2
},
// ... more replies
],
"num_upvotes": 11,
"num_replies": 3,
"days_back": 10,
"is_moderator": false,
"is_pinned": false,
"has_bot_in_username": false,
"is_locked": false,
"is_admin_post": false,
"is_archived_post": false,
"is_moderator_post": false,
"is_quarantined_post": false,
"is_not_safe_for_work_post": false,
"is_eligible_for_content_blocking_post": true,
"is_promoted_post": false,
"post_language": "en",
"post_state": "UNMODERATED",
"post_type": "text"
}
// ... more comments
]
import requests
import json
# Your API Key
api_key = 'YOUR_API_KEY'
# API Endpoint for comments
url = 'https://taskagi.net/api/social-media/reddit-scraper/comments'
# Headers
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
# Request Body
data = {
'url': 'https://www.reddit.com/r/ycombinator/comments/1fgmmcm/how_much_money_do_you_spend_out_of_pocket_on_your/'
}
# Send POST request
response = requests.post(url, headers=headers, json=data)
# Check if the request was successful
if response.status_code == 200:
# Parse the JSON response
comments = response.json()
# Print the comments
print(json.dumps(comments, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
# Example for posts by keyword
url = 'https://taskagi.net/api/social-media/reddit-scraper/posts-by-keyword'
# Request Body for keyword search
data = {
'keyword': 'startup funding'
}
# Send POST request
response = requests.post(url, headers=headers, json=data)
# Check if the request was successful
if response.status_code == 200:
# Parse the JSON response
posts = response.json()
# Print the posts
print(json.dumps(posts, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)