Redditflow.
Mission.
Scrape data from reddit over a period of time of your choice, filter with AI assistants, and connect it to your ML pipelines!
Execution is as simple as this:
- Make a config file with your required details of input.
- Run the API in a single line with the config passed as input.
Installation.
pip install redditflow
Docs.
1) Text API.
| Argument | Input | Description |
|---|---|---|
| sort_by | str | Sort the results by available options like 'best', 'new' ,'top', 'controversial' , etc as available from Reddit. |
| subreddit_text_limit | int | Number of rows to be scraped per subreddit |
| total_limit | int | Total number of rows to be scraped |
| start_time | DateTime | Start date and time in dd.mm.yy hh.mm.ss format |
| stop_time | DateTime | Stop date and time in dd.mm.yy hh.mm.ss format |
| subreddit_search_term | str | Input search term to create filtered outputs |
| subreddit_object_type | str | Available options for scraping are submission and comment. |
| resume_task_timestamp | str, Optional | If task gets interrupted, the timestamp information available from the created folder names can be used to resume. |
| ml_pipeline | Dict, Optional | If an ML pipeline needs to be connected at the end, to have a trained model, specify this parameter |
2) Image API
| Argument | Input | Description |
|---|---|---|
| sort_by | str | Sort the results by available options like 'best', 'new' ,'top', 'controversial' , etc as available from Reddit. |
| subreddit_image_limit | int | Number of images to be scraped per subreddit |
| total_limit | int | Total number of images to be scraped |
| start_time | DateTime | Start date and time in dd.mm.yy hh.mm.ss format |
| stop_time | DateTime | Stop date and time in dd.mm.yy hh.mm.ss format |
| subreddit_search_term | str | Input search term to create filtered outputs |
| subreddit_object_type | str | Available options for scraping are submission and comment |
| client_id | str | Since Image API requires praw, the config requires a praw client ID. |
| client_secret | str | Praw client secret. |
Examples
Text Scraping and filtering
config = {
"sort_by": "best",
"subreddit_text_limit": 50,
"total_limit": 200,
"start_time": "27.03.2021 11:38:42",
"end_time": "27.03.2022 11:38:42",
"subreddit_search_term": "healthcare",
"subreddit_object_type": "comment",
"resume_task_timestamp":1648613439
}
from redditflow import TextApi
TextApi(config)
Image Scraping and filtering
config = {
"sort_by": "best",
"subreddit_image_limit": 3,
"total_limit": 10,
"start_time": "13.11.2021 09:38:42",
"end_time": "15.11.2021 11:38:42",
"subreddit_search_term": "cats",
"subreddit_object_type": "comment",
"client_id": "$CLIENT_ID", # get client id for praw
"client_secret": $CLIENT_SECRET, #get client secret for praw
}
from redditflow import ImageApi
ImageApi(config)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
redditflow-0.1.1.tar.gz
(10.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
redditflow-0.1.1-py3.8.egg
(38.9 kB
view details)
File details
Details for the file redditflow-0.1.1.tar.gz.
File metadata
- Download URL: redditflow-0.1.1.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.0 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b5472fbec10d07e495726c1d6a502636b9f8195296f93d959f2ffa064729f84
|
|
| MD5 |
8a8e68ffbabf003843928f02f523f33d
|
|
| BLAKE2b-256 |
d00ce4e3ee435690b4716c6e67bdd60dddecbeeacc0c31c2419d65d914920907
|
File details
Details for the file redditflow-0.1.1-py3.8.egg.
File metadata
- Download URL: redditflow-0.1.1-py3.8.egg
- Upload date:
- Size: 38.9 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.0 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd7bafb5cef579451add6239a209c8cf8908328f3d47a670db41f517fa04048
|
|
| MD5 |
47e7abaaca0f07be749a32512faee3b6
|
|
| BLAKE2b-256 |
03ad9b176de6620e18a357c2ffa35177d3e877f476435b9743ed181468195494
|