powerdlz23 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerdlz23",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "scripts": {
5
5
  "dev": "next dev",
6
6
  "build": "next build",
@@ -0,0 +1,6 @@
1
+ FROM python:3.10
2
+ WORKDIR /app
3
+ COPY requirements.txt /app/
4
+ RUN pip3 install -r requirements.txt
5
+ COPY . /app
6
+ CMD python3 main.py
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Joy Biswas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ worker: python3 main.py
@@ -0,0 +1,59 @@
1
+
2
+
3
+ # TikTok Downloader Bot
4
+ A Telegram bot to download TikTok videos without any watermark.
5
+ <div align="center">
6
+ <img alt="Python" src="https://img.shields.io/badge/python-%2314354C.svg?&style=for-the-badge&logo=python&logoColor=white"/>
7
+ <img alt="PyCharm" src="https://img.shields.io/badge/PyCharm-000000.svg?&style=for-the-badge&logo=PyCharm&logoColor=white"/>
8
+ <img alt="Git" src="https://img.shields.io/badge/git-%23F05033.svg?&style=for-the-badge&logo=git&logoColor=white"/>
9
+ </div>
10
+ <div align="center">
11
+ <img alt="Heroku" src="https://img.shields.io/badge/Heroku-purple?&style=for-the-badge&logoColor=white&logo=heroku"/>
12
+ <img alt="Telegram" src="https://img.shields.io/badge/Telegram-blue?&style=for-the-badge&logoColor=white&logo=telegram"/>
13
+ </div>
14
+
15
+
16
+
17
+ ### Host on Heroku
18
+
19
+ <p><a href="https://heroku.com/deploy?template=https://github.com/TerminalWarlord/TikTok-Downloader-Bot/tree/master"><img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku"/></a></p>
20
+
21
+ ### Host on Railway
22
+
23
+ <p><a href="https://railway.app/new/template?template=https://github.com/TerminalWarlord/TikTok-Downloader-Bot/tree/master&envs=API_HASH,APP_KEY,BOT_TOKEN,WORKERS,CHANNEL_URL,BOT_URL&API_HASHDesc=Your%20Telegram%20APP%20HASH,%20get%20this%20from%20my.telegram.org%20&APP_IDDesc=Your%20Telegram%20APP%20HASH,%20get%20this%20from%20my.telegram.org%20&BOT_TOKENDesc=Go%20to%20@Botfather%20and%20make%20a%20new%20bot%20and%20paste%20the%20bot%20token%20here&WORKERSDesc=Number%20of%20threads%20to%20use,%20this%20depends%20on%20usage.%204%20is%20the%20recommended%20(and%20default)%20amount,%20but%20your%20experience%20may%20vary%20&CHANNEL_URLDesc=URL%20of%20your%20Telegram%20channel%20link%20&BOT_URLDesc=Username%20of%20your%20Telegram%20Bot%20(without%20@).%20Example:%20JayBeeTikTokBot"><img src="https://railway.app/button.svg" alt="Deploy to Railway"/></a></p>
24
+
25
+ ### Host on Okteto
26
+
27
+ <p><a href="https://cloud.okteto.com/#/deploy?repository=https://github.com/TerminalWarlord/TikTok-Downloader-Bot/"><img src="https://okteto.com/develop-okteto.svg" alt="Deploy to Okteto"/></a></p>
28
+
29
+
30
+
31
+
32
+ Youtube: [Deployment Tutorial](https://youtu.be/LOK3lfJ9ous)<br>
33
+ Demo: [JayBee TikTok Downloader](https://t.me/JayBeeTikTokBot)
34
+
35
+ ## Configuring Environments
36
+ - `API_HASH` : Your Telegram APP HASH, get this from https://my.telegram.org
37
+ - `API_KEY` : Your Telegram APP API KEY, get this from https://my.telegram.org
38
+ - `BOT_TOKEN` : Your bot token, generate it from https://t.me/BotFather
39
+ - `WORKERS` : Number of threads to use, this depends on usage. 4 is the recommended (and default) amount, but your experience may vary.
40
+ - `CHANNEL_URL` : URL of your Telegram channel link.
41
+ - `BOT_URL` : Username of your Telegram Bot (without @). Example: **_JayBeeTikTokBot_**
42
+
43
+
44
+
45
+
46
+ ## Credits
47
+ - [TerminalWarlord](https://github.com/TerminalWarlord)
48
+ ### Show some :heart: and :star: the repo to support the project
49
+
50
+ [![GitHub stars](https://img.shields.io/github/stars/TerminalWarlord/Tiktok-Downloader-Bot.svg?style=social&label=Star)](https://github.com/TerminalWarlord/) ![GitHub followers](https://img.shields.io/github/followers/TerminalWarlord.svg?style=social&label=Follow)
51
+
52
+ [![Telegram Channel](https://img.shields.io/badge/Telegram-Channel-orange)](https://t.me/JayBeeBots)
53
+ ![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/TerminalWarlord/TikTok-Downloader-Bot)
54
+
55
+ ---
56
+ ### Star the Repo if you find it useful :heart:
57
+ ### © [TerminalWarlord](https://t.me/JayBeeBots)
58
+ #### All Rights Reserved
59
+ ---
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "JayBee TikTok Downloader Bot",
3
+ "description": "A Telegram bot to download TikTok videos without any watermark",
4
+ "logo" : "https://telegra.ph/file/05bae0725724007c72fa1.jpg",
5
+ "success_url" : "https://t.me/JayBeeBots",
6
+ "keywords": [
7
+ "telegram",
8
+ "bot",
9
+ "tiktok",
10
+ "jaybee"
11
+ ],
12
+ "repository": "https://github.com/TerminalWarlord/TikTok-Downloader-Bot",
13
+ "website": "https://github.com/TerminalWarlord/TikTok-Downloader-Bot",
14
+ "env": {
15
+ "BOT_TOKEN": {
16
+ "description": "Your bot Bot Token, get this value from @BotFather.",
17
+ "value": ""
18
+ },
19
+ "API_KEY": {
20
+ "description": "Your APP API KEY, get this from https://my.telegram.org",
21
+ "value": ""
22
+ },
23
+ "API_HASH": {
24
+ "description": "Your APP HASH, get this from https://my.telegram.org",
25
+ "value": ""
26
+ },
27
+ "CHANNEL_URL": {
28
+ "description": "URL of your Telegram channel link.",
29
+ "value": ""
30
+ },
31
+ "BOT_URL": {
32
+ "description": "Username of your Telegram Bot (without @). Example: JayBeeTikTokBot",
33
+ "value": ""
34
+ },
35
+ "WORKERS": {
36
+ "description": "Number of threads to use, this depends on usage. 4 is the recommended (and default) amount, but your experience may vary.",
37
+ "value": "4"
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,11 @@
1
+ version: "3.10"
2
+ services:
3
+ worker:
4
+ build: .
5
+ environment:
6
+ - API_HASH=${API_HASH}
7
+ - API_KEY=${API_KEY}
8
+ - BOT_TOKEN=${BOT_TOKEN}
9
+ - WORKERS=${WORKERS}
10
+ - CHANNEL_URL=${CHANNEL_URL}
11
+ - BOT_URL=${BOT_URL}
@@ -0,0 +1,131 @@
1
+ # Copyright 2021 TerminalWarlord under the terms of the MIT
2
+ # license found at https://github.com/TerminalWarlord/TikTok-Downloader-Bot/blob/master/LICENSE
3
+ # Encoding = 'utf-8'
4
+ # Fork and Deploy, do not modify this repo and claim it yours
5
+ # For collaboration mail me at dev.jaybee@gmail.com
6
+ from pyrogram import Client, filters
7
+ from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, InlineQueryResultArticle, InputTextMessageContent
8
+ import shutil
9
+ import requests
10
+ import json
11
+ import os
12
+ import re
13
+ from bs4 import BeautifulSoup as bs
14
+ import time
15
+ from datetime import timedelta
16
+ import math
17
+ import base64
18
+ from progress_bar import progress, TimeFormatter, humanbytes
19
+ from dotenv import load_dotenv
20
+
21
+ load_dotenv()
22
+ bot_token = os.environ.get('BOT_TOKEN')
23
+ workers = int(os.environ.get('WORKERS'))
24
+ api = int(os.environ.get('API_KEY'))
25
+ hash = os.environ.get('API_HASH')
26
+ chnnl = os.environ.get('CHANNEL_URL')
27
+ BOT_URL = os.environ.get('BOT_URL')
28
+ app = Client("JayBee", bot_token=bot_token, api_id=api, api_hash=hash, workers=workers)
29
+
30
+
31
+
32
+ @app.on_message(filters.command('start'))
33
+ def start(client, message):
34
+ kb = [[InlineKeyboardButton('Channel 🛡', url=chnnl),InlineKeyboardButton('Repo 🔰', url="https://github.com/TerminalWarlord/TikTok-Downloader-Bot/")]]
35
+ reply_markup = InlineKeyboardMarkup(kb)
36
+ app.send_message(chat_id=message.from_user.id, text=f"Hello there, I am **TikTok Downloader Bot**.\nI can download TikTok video without Watermark.\n\n"
37
+ "__**Developer :**__ __@JayBeeDev__\n"
38
+ "__**Language :**__ __Python__\n"
39
+ "__**Framework :**__ __🔥 Pyrogram__",
40
+ parse_mode='md',
41
+ reply_markup=reply_markup)
42
+
43
+
44
+
45
+
46
+ @app.on_message(filters.command('help'))
47
+ def help(client, message):
48
+ kb = [[InlineKeyboardButton('Channel 🛡', url=chnnl),InlineKeyboardButton('Repo 🔰', url="https://github.com/TerminalWarlord/TikTok-Downloader-Bot/")]]
49
+ reply_markup = InlineKeyboardMarkup(kb)
50
+ app.send_message(chat_id=message.from_user.id, text=f"Hello there, I am **TikTok Downloader Bot**.\nI can download any TikTok video from a given link.\n\n"
51
+ "__Send me a TikTok video link__",
52
+ parse_mode='md',
53
+ reply_markup=reply_markup)
54
+
55
+
56
+ @app.on_message((filters.regex("http://")|filters.regex("https://")) & (filters.regex('tiktok')|filters.regex('douyin')))
57
+ def tiktok_dl(client, message):
58
+ a = app.send_message(chat_id=message.chat.id,
59
+ text='__Downloading File to the Server__',
60
+ parse_mode='md')
61
+ link = re.findall(r'\bhttps?://.*[(tiktok|douyin)]\S+', message.text)[0]
62
+ link = link.split("?")[0]
63
+
64
+
65
+
66
+
67
+ params = {
68
+ "link": link
69
+ }
70
+ headers = {
71
+ 'x-rapidapi-host': "tiktok-info.p.rapidapi.com",
72
+ 'x-rapidapi-key': "f9d65af755msh3c8cac23b52a5eep108a33jsnbf7de971bb72"
73
+ }
74
+
75
+ ### Get your Free TikTok API from https://rapidapi.com/TerminalWarlord/api/tiktok-info/
76
+ #Using the default one can stop working any moment
77
+
78
+ api = f"https://tiktok-info.p.rapidapi.com/dl/"
79
+ r = requests.get(api, params=params, headers=headers).json()['videoLinks']['download']
80
+ directory = str(round(time.time()))
81
+ filename = str(int(time.time()))+'.mp4'
82
+ size = int(requests.head(r).headers['Content-length'])
83
+ total_size = "{:.2f}".format(int(size) / 1048576)
84
+ try:
85
+ os.mkdir(directory)
86
+ except:
87
+ pass
88
+ with requests.get(r, timeout=(50, 10000), stream=True) as r:
89
+ r.raise_for_status()
90
+ with open(f'./{directory}/{filename}', 'wb') as f:
91
+ chunk_size = 1048576
92
+ dl = 0
93
+ show = 1
94
+ for chunk in r.iter_content(chunk_size=chunk_size):
95
+ f.write(chunk)
96
+ dl = dl + chunk_size
97
+ percent = round(dl * 100 / size)
98
+ if percent > 100:
99
+ percent = 100
100
+ if show == 1:
101
+ try:
102
+ a.edit(f'__**URL :**__ __{message.text}__\n'
103
+ f'__**Total Size :**__ __{total_size} MB__\n'
104
+ f'__**Downloaded :**__ __{percent}%__\n',
105
+ disable_web_preview=False)
106
+ except:
107
+ pass
108
+ if percent == 100:
109
+ show = 0
110
+
111
+ a.edit(f'__Downloaded to the server!\n'
112
+ f'Uploading to Telegram Now ⏳__')
113
+ start = time.time()
114
+ title = filename
115
+ app.send_document(chat_id=message.chat.id,
116
+ document=f"./{directory}/{filename}",
117
+ caption=f"**File :** __{filename}__\n"
118
+ f"**Size :** __{total_size} MB__\n\n"
119
+ f"__Uploaded by @{BOT_URL}__",
120
+ file_name=f"{directory}",
121
+ parse_mode='md',
122
+ progress=progress,
123
+ progress_args=(a, start, title))
124
+ a.delete()
125
+ try:
126
+ shutil.rmtree(directory)
127
+ except:
128
+ pass
129
+
130
+
131
+ app.run()
@@ -0,0 +1,63 @@
1
+ import time, math
2
+
3
+
4
+
5
+ async def progress(current,total,a,start, title):
6
+ now = time.time()
7
+ diff = now - start
8
+ if round(diff % 10.00) == 0 or current == total:
9
+ # if round(current / total * 100, 0) % 5 == 0:
10
+ percentage = current * 100 / total
11
+ speed = current / diff
12
+ elapsed_time = round(diff) * 1000
13
+ time_to_completion = round((total - current) / speed) * 1000
14
+ estimated_total_time = elapsed_time + time_to_completion
15
+
16
+ elapsed_time = TimeFormatter(milliseconds=elapsed_time)
17
+ estimated_total_time = TimeFormatter(milliseconds=estimated_total_time)
18
+
19
+ progress = "__**Progress :**__ `[{0}{1}] {2}%`\n".format(
20
+ ''.join(["●" for i in range(math.floor(percentage / 5))]),
21
+ ''.join([" " for i in range(20 - math.floor(percentage / 5))]),
22
+ round(percentage, 2))
23
+
24
+ tmp = progress + "__**Uploaded :**__ {0} of {1}\n__**Speed :**__ {2}/s\n__**ETA :**__ {3}\n".format(
25
+ humanbytes(current),
26
+ humanbytes(total),
27
+ humanbytes(speed),
28
+ # elapsed_time if elapsed_time != '' else "0 s",
29
+ estimated_total_time if estimated_total_time != '' else "0 s"
30
+ )
31
+ try:
32
+ await a.edit(
33
+ text=f"__**File :**__ __{title}__\n"
34
+ f"{tmp}"
35
+ )
36
+ except:
37
+ pass
38
+
39
+ def humanbytes(size):
40
+ # https://stackoverflow.com/a/49361727/4723940
41
+ # 2**10 = 1024
42
+ if not size:
43
+ return ""
44
+ power = 2**10
45
+ n = 0
46
+ Dic_powerN = {0: ' ', 1: 'K', 2: 'M', 3: 'G', 4: 'T'}
47
+ while size > power:
48
+ size /= power
49
+ n += 1
50
+ return str(round(size, 2)) + " " + Dic_powerN[n] + 'B'
51
+
52
+
53
+ def TimeFormatter(milliseconds: int) -> str:
54
+ seconds, milliseconds = divmod(int(milliseconds), 1000)
55
+ minutes, seconds = divmod(seconds, 60)
56
+ hours, minutes = divmod(minutes, 60)
57
+ days, hours = divmod(hours, 24)
58
+ tmp = ((str(days) + "d, ") if days else "") + \
59
+ ((str(hours) + "h, ") if hours else "") + \
60
+ ((str(minutes) + "m, ") if minutes else "") + \
61
+ ((str(seconds) + "s, ") if seconds else "") + \
62
+ ((str(milliseconds) + "ms, ") if milliseconds else "")
63
+ return tmp[:-2]
@@ -0,0 +1,6 @@
1
+ Pyrogram==1.1.9
2
+ requests
3
+ tgcrypto
4
+ pymongo[srv]
5
+ python-dotenv
6
+ bs4
@@ -0,0 +1 @@
1
+ python-3.8.5