Skip to content

Commit

Permalink
🎉 Initial stable release
Browse files Browse the repository at this point in the history
  • Loading branch information
nssharmaofficial committed Jul 29, 2024
0 parents commit e476f6c
Show file tree
Hide file tree
Showing 21 changed files with 2,011 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
env/
__pycache__/
assets/temp
results/
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

145 changes: 145 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# reddit-hole 🐰

### Let me ask you:

- 🙋 Would you like to start uploading the trendy Reddit videos on some platform too?
- 😨 Are you overwhelmed by the existing solution of [RedditVideoMakerBot](https://github.com/elebumm/RedditVideoMakerBot) as it lacks readability and it is hard to modify it on your own?
- 😴 Are you tired of debugging all the issues of the simpler version of it [YoutubeAutomation-Reddit](https://github.com/aahashemi/YouTubeAutomation-Reddit/tree/main)?

<img src="docs/reddit-banner.png" alt="reddit-create-app" width="400"/>

### If you replied ⭐ **yes** ⭐ to any of the question above, this is the right place for you! Why this project stands out?

- 😏 option to choose from creating long "storymode" videos with captions or shorts with the comments' screenshots
- 📒 proper code documentation and readability
- ✅ keeping it simple but configurable (easy to contribute!)


## Examples 🎥

👉 [long "storymode" video](https://www.youtube.com/watch?v=5CCY67G0FBg&t=24s)

👉 [shorts](https://www.youtube.com/shorts/bmCKxse31s8)

## File structure

```plaintext
reddit-hole/
├── assets/
│ ├── background/
│ ├── fonts/
│ ├── temp/
│ ├── config.toml
│ ├── cookie-dark-mode.json
│ ├── cookie-light-mode.json
│ ├── database.json
│ └── my_title_template.png
├── docs/
├── env/
├── results/
│ ├── long/
│ ├── short/
├── utils/
│ ├── captions.py
│ ├── helpers.py
│ ├── reddit.py
│ ├── tts.py
│ └── videomaker.py
├── .env
├── .gitignore
├── LICENSE
├── main.py
├── README.md
└── requirements.txt
```

## Installation 👨‍💻

1. Clone this repository
1. Create virtual environment and install all dependencies

```bash
python -m venv env
source env/bin/activate
pip install -r requirements.txt
python -m playwright install and python -m playwright install-deps
```
1. Create `.env` file to store environment variables
1. Setup [AWS (Free Tier)](https://aws.amazon.com/)
- Sing in to the console
- Create **access key** and save it along with the **secret access key**
- Save it in the `.env` file

```.env
# .env
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION_NAME=
```
1. Go to [Reddit App Preferences](https://www.reddit.com/prefs/apps) and click on create another app at the bottom.
- Fill out the required details, make sure to select **script** and click on create app.
<img src="docs/reddit1.png" alt="reddit-create-app" width="600"/>
- Make a note of the **personal use script** and **secret token** and update the the following credentials in the `config.toml` file.
<img src="docs/reddit2.png" alt="reddit-save-tokens" width="600"/>
- Save it in the `.env` file along with your credentials:
```.env
# .env
REDDIT_CLIENT_ID=
REDDIT_CLIENT_SECRET=
REDDIT_USER_AGENT="Accessing Reddit Threads"
REDDIT_USERNAME=
REDDIT_PASSKEY=
```
1. Download any YouTube video as a background
- Here are a few options:
- [Minecraft (1:20 h)](https://youtu.be/n_Dv4JMiwK8)
- [GTA (1:00 h)](https://youtu.be/qdvjZ1bUw68)
- [Subway Surfer (1:05 h)](https://youtu.be/ChBg4aowzX8)
- Save the path in the `.env` file:
```.env
# .env
BACKGROUND="/reddit-hole/assets/background/minecraft.mp4"
```
1. Setup configuration in [config](/assets/config.toml):
```.toml
[Reddit]
subreddit='AskReddit'
[settings]
storymode=false
opacity = 0.75
resolution_w = 1920
resolution_h = 1080
pause=0.6
multiple_voices=false
voice_id='Matthew'
```

Specifically for comments mode (`storymode=false`):

```.toml
[Reddit]
topn_comments=10
max_comment_length=300
min_comment_length=10

[settings]
total_video_duration=59
theme="dark"
zoom = 1.25
```

All we are left do is run:

```bash
python main.py
```
Empty file added assets/background/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions assets/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ----------------------------------------------------------
[paths]
background='$BACKGROUND'
# ----------------------------------------------------------
[RedditCredential]
client_id='$REDDIT_CLIENT_ID'
client_secret='$REDDIT_CLIENT_SECRET'
user_agent="$REDDIT_USER_AGENT"
username="$REDDIT_USERNAME"
passkey="$REDDIT_PASSKEY"
# ----------------------------------------------------------
[AmazonAWSCredential]
aws_access_key_id='$AWS_ACCESS_KEY_ID'
aws_secret_access_key='$AWS_SECRET_ACCESS_KEY'
region_name='$AWS_REGION_NAME'
# ----------------------------------------------------------
[Reddit]
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
subreddit='AskReddit'
topn_comments=10
max_comment_length=300
min_comment_length=10
# ----------------------------------------------------------
[settings]
storymode=false
opacity = 0.75
resolution_w = 1920
resolution_h = 1080
pause=0.6
multiple_voices=false
voice_id='Matthew'
total_video_duration=59
theme="dark"
zoom = 1.25
14 changes: 14 additions & 0 deletions assets/cookie-dark-mode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"name": "USER",
"value": "eyJwcmVmcyI6eyJ0b3BDb250ZW50RGlzbWlzc2FsVGltZSI6MCwiZ2xvYmFsVGhlbWUiOiJSRURESVQiLCJuaWdodG1vZGUiOnRydWUsImNvbGxhcHNlZFRyYXlTZWN0aW9ucyI6eyJmYXZvcml0ZXMiOmZhbHNlLCJtdWx0aXMiOmZhbHNlLCJtb2RlcmF0aW5nIjpmYWxzZSwic3Vic2NyaXB0aW9ucyI6ZmFsc2UsInByb2ZpbGVzIjpmYWxzZX0sInRvcENvbnRlbnRUaW1lc0Rpc21pc3NlZCI6MH19",
"domain": ".reddit.com",
"path": "/"
},
{
"name": "eu_cookie",
"value": "{%22opted%22:true%2C%22nonessential%22:false}",
"domain": ".reddit.com",
"path": "/"
}
]
8 changes: 8 additions & 0 deletions assets/cookie-light-mode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "eu_cookie",
"value": "{%22opted%22:true%2C%22nonessential%22:false}",
"domain": ".reddit.com",
"path": "/"
}
]
1 change: 1 addition & 0 deletions assets/database.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file added assets/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/UbuntuMono-Bold.ttf
Binary file not shown.
Binary file added assets/my_title_template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/reddit-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/reddit1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/reddit2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e476f6c

Please sign in to comment.