mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-22 06:13:55 +08:00
parent
dd2af8dcc0
commit
56b0dd2a04
3 changed files with 9 additions and 1 deletions
|
@ -146,7 +146,7 @@ You can configure all the following environment variables:
|
|||
* FREE_DOWNLOAD: free download count per day
|
||||
* TOKEN_PRICE: token price per 1 USD
|
||||
* GOOGLE_API_KEY: YouTube API key, required for YouTube video subscription.
|
||||
|
||||
* RCLONE_PATH: rclone path to upload files to cloud storage
|
||||
## 3.2 Set up init data
|
||||
|
||||
If you only need basic functionality, you can skip this step.
|
||||
|
|
|
@ -64,3 +64,4 @@ TOKEN_PRICE = os.getenv("BUY_UNIT", 20) # one USD=20 credits
|
|||
RATE_LIMIT = os.getenv("RATE_LIMIT", 20)
|
||||
|
||||
SS_YOUTUBE = os.getenv("SS_YOUTUBE", "https://ytdlbot.dmesg.app?token=123456")
|
||||
RCLONE_PATH = os.getenv("RCLONE")
|
||||
|
|
|
@ -13,6 +13,7 @@ import os
|
|||
import pathlib
|
||||
import random
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import threading
|
||||
|
@ -42,6 +43,7 @@ from config import (
|
|||
ENABLE_QUEUE,
|
||||
ENABLE_VIP,
|
||||
OWNER,
|
||||
RCLONE_PATH,
|
||||
RATE_LIMIT,
|
||||
WORKERS,
|
||||
)
|
||||
|
@ -278,6 +280,11 @@ def ytdl_normal_download(client: Client, bot_msg: typing.Union[types.Message, ty
|
|||
|
||||
bot_msg.edit_text("Download success!✅")
|
||||
|
||||
# setup rclone environment var to back up the downloaded file
|
||||
if RCLONE_PATH:
|
||||
for item in os.listdir(temp_dir.name):
|
||||
logging.info("Copying %s to %s", item, RCLONE_PATH)
|
||||
shutil.copy(os.path.join(temp_dir.name, item), RCLONE_PATH)
|
||||
temp_dir.cleanup()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue