Skip to main content

Python library for scraping Reddit data, powered by a .NET 9 backend

Project description

RedScrapsLib

A Python library for scraping Reddit data (posts, comments, user activity) without the official API. Backed by a .NET 9 assembly via pythonnet, with automatic rate-limit handling.

Requirements

  • Python 3.10+
  • Windows x64
  • .NET 9 Runtime — must be installed separately; pip cannot install it

Installation

pip install redscrapslib

Quick start

import RedScrapsLib as rs

rs.init(user_agent="MyBot/1.0")

# Subreddit posts
posts = rs.get_home("python", limit=10)
for post in posts.Posts:
    print(post.Title, post.Author)

# Post comments
comments = rs.get_comments("python", post_id="abc123", limit=50)

# User activity
submissions = rs.get_user_posts("spez", limit=25)
user_comments = rs.get_user_comments("spez", limit=25)

# Session stats
print(rs.get_stats())
# {'calls': 4, 'rate_limit_hits': 0, 'total_wait_seconds': 0.0}

Rate limiting is handled automatically. If Reddit returns a 429, the library waits the required time and retries — no extra code needed.

API

init(user_agent=None, debug=False)

Must be called once before any other function.

get_home(subreddit, sort="hot", limit=100, time=None, after=None) → HomeSent

get_comments(subreddit, post_id, sort="confidence", limit=100) → CommentSent

get_user_posts(user, sort=None, limit=None, time=None, after=None) → UserSubmittedSent

get_user_comments(user, sort=None, limit=None, time=None, after=None) → UserCommentsSent

get_stats() → dict

Returns {'calls': int, 'rate_limit_hits': int, 'total_wait_seconds': float}.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

redscrapslib-0.1.0-py3-none-macosx_12_0_universal2.whl (22.9 kB view details)

Uploaded Python 3macOS 12.0+ universal2 (ARM64, x86-64)

redscrapslib-0.1.0-cp313-cp313-win_amd64.whl (22.9 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file redscrapslib-0.1.0-py3-none-macosx_12_0_universal2.whl.

File metadata

File hashes

Hashes for redscrapslib-0.1.0-py3-none-macosx_12_0_universal2.whl
Algorithm Hash digest
SHA256 3b9307feac5027f5cc7f6e06a2289d4c40912ebbd080191988f773919ac582cf
MD5 9efd246e1acdf7d9436ca41d76637778
BLAKE2b-256 2e998e14abce1586ece35163f53b9fb9050def2e39b1a5954a1b25ad26e49eee

See more details on using hashes here.

File details

Details for the file redscrapslib-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for redscrapslib-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f5983fcf0d1096852cd844680a6c550b5bd564033f53f1bd7c0e431e4ca1d79b
MD5 edc91d5c60096b54d9fcf3670aed56c7
BLAKE2b-256 4cc46ad01db3c896114a7f99fda8495aa4b11204f778de8206af9b6a0fb8856f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page