nothere990 commited on
Commit
2e8d814
·
1 Parent(s): 9756c2a
Files changed (7) hide show
  1. .env.example +0 -66
  2. Dockerfile +67 -16
  3. Dockerfile.bak +16 -0
  4. README.md +10 -200
  5. requirements.txt +2 -0
  6. server.py +12 -0
  7. src/server.py +12 -0
.env.example DELETED
@@ -1,66 +0,0 @@
1
- # Example .env file for ytdlbot configuration
2
-
3
- # Number of workers (default is 100)
4
- WORKERS=100
5
-
6
- # Telegram app ID
7
- APP_ID=
8
-
9
- # Telegram app hash
10
- APP_HASH=
11
-
12
- # Telegram bot token
13
- BOT_TOKEN=
14
-
15
- # Owner ID, comma-separated
16
- OWNER=
17
-
18
- # List of authorized users, comma-separated
19
- AUTHORIZED_USER=
20
-
21
- # Database connection address, i.e. mysql+pymysql://user:pass@mysql/dbname
22
- DB_DSN=mysql+pymysql://ytdlbot:your_password@mysql/ytdlbot
23
-
24
- # Redis host, leave it empty to use fakeredis
25
- REDIS_HOST=redis
26
-
27
- # Enable FFMPEG for video processing (True/False)
28
- ENABLE_FFMPEG=False
29
-
30
- # Desired audio format (e.g., mp3, wav), leave it empty to use m4a
31
- AUDIO_FORMAT=
32
-
33
- # Enable m3u8 link support (True/False)
34
- M3U8_SUPPORT=False
35
-
36
- # Enable Aria2 for downloads (True/False)
37
- ENABLE_ARIA2=False
38
-
39
- # Path to Rclone executable
40
- RCLONE_PATH=
41
-
42
- # Enable VIP features (True/False)
43
- ENABLE_VIP=False
44
-
45
- # Payment provider token from Bot Father
46
- PROVIDER_TOKEN=
47
-
48
- # Free downloads allowed per user
49
- FREE_DOWNLOAD=5
50
-
51
- # Rate limit for requests
52
- RATE_LIMIT=120
53
-
54
- # Path for temporary files (ensure the directory exists and is writable)
55
- TMPFILE_PATH=
56
-
57
- # Maximum size for Telegram uploads in MB
58
- TG_NORMAL_MAX_SIZE=2000
59
-
60
- # Maximum URL length in captions
61
- CAPTION_URL_LENGTH_LIMIT=150
62
-
63
- # potoken 'https://github.com/yt-dlp/yt-dlp/wiki/PO-Token-Guide'
64
- POTOKEN=11
65
-
66
- BROWSERS=firefox
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockerfile CHANGED
@@ -1,16 +1,67 @@
1
- FROM python:3.12-alpine AS pybuilder
2
- ADD pyproject.toml pdm.lock /build/
3
- WORKDIR /build
4
- RUN apk add alpine-sdk python3-dev musl-dev linux-headers
5
- RUN pip install pdm
6
- RUN pdm install
7
-
8
- FROM python:3.12-alpine AS runner
9
- WORKDIR /app
10
-
11
- RUN apk update && apk add --no-cache ffmpeg aria2
12
- COPY --from=pybuilder /build/.venv/lib/ /usr/local/lib/
13
- COPY src /app
14
- WORKDIR /app
15
-
16
- CMD ["python" ,"main.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.12-alpine as the base image
2
+ FROM python:3.12-alpine
3
+
4
+ # Set timezone (optional, but included for consistency)
5
+ ENV TZ=Asia/Kolkata
6
+ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
7
+
8
+ # Install system dependencies
9
+ RUN apk update && \
10
+ apk add --no-cache \
11
+ alpine-sdk \
12
+ python3-dev \
13
+ musl-dev \
14
+ linux-headers \
15
+ git \
16
+ curl \
17
+ wget \
18
+ jq \
19
+ neofetch \
20
+ mediainfo
21
+
22
+ # Manual FFmpeg installation (preserved as requested)
23
+ RUN wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz \
24
+ && wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz.md5 \
25
+ && md5sum -c ffmpeg-git-amd64-static.tar.xz.md5 \
26
+ && tar xf ffmpeg-git-amd64-static.tar.xz \
27
+ && mv ffmpeg-git-*-amd64-static/ffmpeg ffmpeg-git-*-amd64-static/ffprobe /usr/local/bin/ \
28
+ && rm -rf ffmpeg-git-* ffmpeg-git-amd64-static.tar.xz*
29
+
30
+ # Install aria2c static binary
31
+ RUN wget -q https://github.com/P3TERX/Aria2-Pro-Core/releases/download/1.36.0_2021.08.22/aria2-1.36.0-static-linux-amd64.tar.gz \
32
+ && tar -xf aria2-1.36.0-static-linux-amd64.tar.gz \
33
+ && mv aria2c /usr/local/bin/ \
34
+ && rm -rf aria2-1.36.0-static-linux-amd64.tar.gz aria2c
35
+
36
+ # Create user with UID 1000 (Hugging Face requirement)
37
+ RUN adduser -D -u 1000 user
38
+
39
+ # Set environment variables for the non-root user
40
+ ENV HOME=/home/user \
41
+ PATH=/home/user/.local/bin:$PATH
42
+
43
+ # Set working directory (creates /home/user/app automatically)
44
+ WORKDIR $HOME/app
45
+
46
+ # (Optional) If you want to disable pip caching entirely, you can skip creating the cache directory.
47
+ # Otherwise, you could fix its permissions—but here we opt to disable caching.
48
+ RUN mkdir -p $HOME/.cache
49
+
50
+ # Adjust ownership/permissions for the app directory (and /usr if needed)
51
+ RUN chown -R 1000:0 $HOME/app $HOME/.cache /usr && \
52
+ chmod -R 777 $HOME/app /usr $HOME/.cache
53
+
54
+ # Install PDM and project dependencies
55
+ COPY pyproject.toml pdm.lock ./
56
+ RUN pip install --no-cache-dir --upgrade pip setuptools \
57
+ && pip install --no-cache-dir pdm \
58
+ && pdm install
59
+
60
+ # Copy application code
61
+ COPY src .
62
+
63
+ # Expose port (if needed)
64
+ EXPOSE 7860
65
+
66
+ # Command to run the application
67
+ CMD ["python", "server.py", "&", "python", "main.py"]
Dockerfile.bak ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-alpine AS pybuilder
2
+ ADD pyproject.toml pdm.lock /build/
3
+ WORKDIR /build
4
+ RUN apk add alpine-sdk python3-dev musl-dev linux-headers
5
+ RUN pip install pdm
6
+ RUN pdm install
7
+
8
+ FROM python:3.12-alpine AS runner
9
+ WORKDIR /app
10
+
11
+ RUN apk update && apk add --no-cache ffmpeg aria2
12
+ COPY --from=pybuilder /build/.venv/lib/ /usr/local/lib/
13
+ COPY src /app
14
+ WORKDIR /app
15
+
16
+ CMD ["python" ,"main.py"]
README.md CHANGED
@@ -1,200 +1,10 @@
1
- # ytdlbot
2
-
3
- [![docker image](https://github.com/tgbot-collection/ytdlbot/actions/workflows/builder.yaml/badge.svg)](https://github.com/tgbot-collection/ytdlbot/actions/workflows/builder.yaml)
4
-
5
- **YouTube Download Bot🚀🎬⬇️**
6
-
7
- This Telegram bot allows you to download videos from YouTube and [other supported websites](#supported-websites).
8
-
9
- # Usage
10
-
11
- * EU🇪🇺: [https://t.me/benny_2ytdlbot](https://t.me/benny_2ytdlbot)
12
- * Singapore🇸🇬:[https://t.me/benny_ytdlbot](https://t.me/benny_ytdlbot)
13
-
14
- * Join Telegram Channel https://t.me/ytdlbot0 for updates.
15
-
16
- Just send a link directly to the bot.
17
-
18
- # Supported websites
19
-
20
- * YouTube
21
- * Any websites [supported by yt-dlp](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)
22
-
23
- ### Specific link downloader (Use /spdl for these links)
24
- * Instagram (Videos, Photos, Reels, IGTV & carousel)
25
- * Pixeldrain
26
- * KrakenFiles
27
-
28
- # Features
29
-
30
- 1. fast download and upload.
31
- 2. No ads
32
- 3. download & upload progress bar
33
- 4. download quality selection
34
- 5. upload format: file, video, audio
35
- 6. cache mechanism - download once for the same video.
36
- 7. Supports multiple download engines (yt-dlp, aria2, requests).
37
-
38
- > ## Limitations
39
- > Due to limitations on servers and bandwidth, there are some restrictions on this free service.
40
- > * Each user is limited to 1 free downloads every day.
41
-
42
- # Screenshots
43
-
44
- ## Normal download
45
-
46
- ![](assets/1.jpeg)
47
-
48
- ## Instagram download
49
-
50
- ![](assets/instagram.png)
51
-
52
- ![](assets/2.jpeg)
53
-
54
- # How to deploy?
55
-
56
- This bot can be deployed on any platform that supports Python.
57
-
58
- ## Run natively on your machine
59
-
60
- > Project use PDM to manage dependencies.
61
-
62
- 1. <details>
63
- <summary>Install PDM</summary>
64
-
65
- You can install using pip: `pip install --user pdm`
66
- or for detailed instructions: [Official Docs](https://pdm-project.org/en/latest/#installation)
67
-
68
- </details>
69
-
70
- 2. Install modules using PDM: `pdm install`, or the old way use `pip install -r requirements.txt`
71
-
72
- 3. <details>
73
- <summary>Setting up config file</summary>
74
-
75
- ```
76
- cp .env.example .env
77
- ```
78
-
79
- Fill the fields in `.env`. For more information, see the comments in the `.env.example` file.
80
-
81
- **- Required Fields**
82
- - `WORKERS`: Number of workers (default is 100)
83
- - `APP_ID`: Telegram app ID
84
- - `APP_HASH`: Telegram app hash
85
- - `BOT_TOKEN`: Your telegram bot token
86
- - `OWNER`: Owner ID (separate by `,`)
87
- - `AUTHORIZED_USER`: List of authorized users ids, (separate by `,`)
88
- - `DB_DSN`: Your database URL (mysql+pymysql://user:pass@mysql/dbname) or SQLite (sqlite:///db.sqlite)
89
- - `REDIS_HOST`: Redis host
90
-
91
- **- Optional Fields**
92
- - `ENABLE_FFMPEG`: Enable FFMPEG for video processing (True/False)
93
- - `AUDIO_FORMAT`: Desired audio format (e.g.:- mp3, wav)
94
- - `ENABLE_ARIA2`: Enable Aria2 for downloads (True/False)
95
- - `RCLONE_PATH`: Path to Rclone executable
96
- - `ENABLE_VIP`: Enable VIP features (True/False)
97
- - `PROVIDER_TOKEN`: Payment provider token from Stripe
98
- - `FREE_DOWNLOAD`: Free downloads allowed per user
99
- - `RATE_LIMIT`: Rate limit for requests
100
- - `TMPFILE_PATH`: Path for temporary/download files (ensure the directory exists and is writable)
101
- - `TG_NORMAL_MAX_SIZE`: Maximum size for Telegram uploads in MB
102
- - `CAPTION_URL_LENGTH_LIMIT`: Maximum URL length in captions
103
- - `POTOKEN`: Your PO Token. [PO-Token-Guide](https://github.com/yt-dlp/yt-dlp/wiki/PO-Token-Guide)
104
- - `BROWSERS`: Browser to handle 'cookies from browser', i.e. firefox
105
- </details>
106
-
107
- 4. Activate virtual environment that created by PDM: `source .venv/bin/activate`
108
-
109
- 5. Finally run the bot: `python src/main.py`
110
-
111
- ## Docker
112
-
113
- One line command to run the bot
114
-
115
- ```shell
116
- docker run --env-file .env bennythink/ytdlbot
117
- ```
118
-
119
- # Command
120
-
121
- ```
122
- start - Let's start
123
- about - What's this bot?
124
- help - Help
125
- spdl - Use to download specific link downloader links
126
- direct - Download using aria2/requests engines
127
- ytdl - Download video in group
128
- settings - Set your preference
129
- unsub - Unsubscribe from YouTube Channel
130
- ping - Ping the Bot
131
- stats - Server and bot stats
132
- buy - Buy quota.
133
- ```
134
-
135
- # Test data
136
-
137
- <details><summary>Tap to expand</summary>
138
-
139
- ## Test video
140
-
141
- https://www.youtube.com/watch?v=V3RtA-1b_2E
142
-
143
- ## Test Playlist
144
-
145
- https://www.youtube.com/playlist?list=PL1Hdq7xjQCJxQnGc05gS4wzHWccvEJy0w
146
-
147
- ## Test twitter
148
-
149
- https://twitter.com/nitori_sayaka/status/1526199729864200192
150
- https://twitter.com/BennyThinks/status/1475836588542341124
151
-
152
- ## Test instagram
153
-
154
- * single image: https://www.instagram.com/p/CXpxSyOrWCA/
155
- * single video: https://www.instagram.com/p/Cah_7gnDVUW/
156
- * reels: https://www.instagram.com/p/C0ozGsjtY0W/
157
- * image carousel: https://www.instagram.com/p/C0ozPQ5o536/
158
- * video and image carousel: https://www.instagram.com/p/C0ozhsVo-m8/
159
-
160
- ## Test Pixeldrain
161
-
162
- https://pixeldrain.com/u/765ijw9i
163
-
164
- ## Test KrakenFiles
165
-
166
- https://krakenfiles.com/view/oqmSTF0T5t/file.html
167
-
168
- </details>
169
-
170
- # Donation
171
-
172
- Found this bot useful? You can donate to support the development of this bot.
173
-
174
- ## Donation Platforms
175
-
176
- * [Buy me a coffee](https://www.buymeacoffee.com/bennythink)
177
- * [GitHub Sponsor](https://github.com/sponsors/BennyThink)
178
-
179
- ## Stripe
180
-
181
- You can choose to donate via Stripe.
182
-
183
- | USD(Card, Apple Pay and Google Pay) | CNY(Card, Apple Pay, Google Pay and Alipay) |
184
- |--------------------------------------------------|--------------------------------------------------|
185
- | [USD](https://buy.stripe.com/cN203sdZB98RevC3cd) | [CNY](https://buy.stripe.com/dR67vU4p13Ox73a6oq) |
186
- | ![](assets/USD.png) | ![](assets/CNY.png) |
187
-
188
- ## Cryptocurrency
189
-
190
- TRX or USDT(TRC20)
191
-
192
- ![](assets/tron.png)
193
-
194
- ```
195
- TF9peZjC2FYjU4xNMPg3uP4caYLJxtXeJS
196
- ```
197
-
198
- # License
199
-
200
- Apache License 2.0
 
1
+ ---
2
+ title: Demoss
3
+ emoji: 📊
4
+ colorFrom: indigo
5
+ colorTo: pink
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -17,3 +17,5 @@ psutil>=6.1.0
17
  ffpb>=0.4.1
18
  kurigram==2.1.38
19
  cryptography>=43.0.3
 
 
 
17
  ffpb>=0.4.1
18
  kurigram==2.1.38
19
  cryptography>=43.0.3
20
+ fastapi
21
+ uvicorn[standard]
server.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import uvicorn
3
+ from fastapi import FastAPI
4
+
5
+ app = FastAPI(docs_url=None, redoc_url="/")
6
+
7
+ @app.get("/status")
8
+ def hello():
9
+ return {"message": "running"}
10
+
11
+ if __name__ == "__main__":
12
+ uvicorn.run(app, host="0.0.0.0", port=7860)
src/server.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import uvicorn
3
+ from fastapi import FastAPI
4
+
5
+ app = FastAPI(docs_url=None, redoc_url="/")
6
+
7
+ @app.get("/status")
8
+ def hello():
9
+ return {"message": "running"}
10
+
11
+ if __name__ == "__main__":
12
+ uvicorn.run(app, host="0.0.0.0", port=7860)