Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
reddit2text
is the Python library designed to effortlessly transform any Reddit thread into clean, readable text data.
Perfect for feeding to an LLM, performing textual/data analysis, or simply archiving for offline use, reddit2text
offers a straightforward interface to access and convert content from Reddit.
Have a Feature Idea?
Simply open an issue on github and tell us what should be added to the next release!
Easy install using pip
pip3 install reddit2text
First, you need to create a Reddit app to get your client_id and client_secret. Follow the instructions on Reddit's API documentation to set up your application.
Then, replace the client_id
, client_secret
, and user_agent
with your credentials.
The user agent can be anything you like, but we recommend following this convention according to Reddit's guidelines: '<app type>:<app name>:<version> (by <your username>)'
Here's an example:
from reddit2text import Reddit2Text
r2t = Reddit2Text(
# example credentials
client_id='123abc',
client_secret='123abc',
user_agent='script:my_app:v1.0 (by u/reddit2text)'
)
# The URL must have the post ID after the /comments/ to work, e.g. `1buyr0g`
URL = 'https://www.reddit.com/r/MadeMeSmile/comments/1buyr0g/ryan_reynolds_being_wholesome/'
output = r2t.textualize_post(URL)
print(output)
Here is an example (truncated) output from the above code! https://pastebin.com/mmHFJtcc
None
or -1
to include all.|
to mimic reddit.r2t = Reddit2Text(
# credentials ...
max_comment_depth=3, # all comment chains will be limited to a max of 3 replies
comment_delim='#' # each comment level will be preceded by multiples of this string
)
Contributions to reddit2text are welcome. Please submit pull requests or issues to our GitHub repository.
reddit2text is released under the MIT License. See the LICENSE file for more details.
FAQs
Convert Reddit posts to text
We found that reddit2text demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.