Update main.py
Browse files
main.py
CHANGED
@@ -2,8 +2,8 @@ import logging
|
|
2 |
from pyrogram import Client, filters
|
3 |
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
|
4 |
from pyrogram.types import *
|
5 |
-
|
6 |
-
from config import TIKTOK_WEB
|
7 |
import hashlib
|
8 |
|
9 |
logging.getLogger("pyrogram").setLevel(logging.WARNING)
|
@@ -11,25 +11,22 @@ logging.basicConfig(level=logging.INFO)
|
|
11 |
|
12 |
WELCOME_TEXT = """
|
13 |
Halo {}
|
14 |
-
Saya adalah bot untuk mengunduh video
|
15 |
|
16 |
-
|
|
|
|
|
|
|
17 |
"""
|
18 |
|
19 |
client = Client(
|
20 |
-
"
|
21 |
api_id=API_ID,
|
22 |
api_hash=API_HASH,
|
23 |
bot_token=BOT_TOKEN
|
24 |
)
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
def generate_callback_data(user_id, query):
|
29 |
-
identifier = hashlib.md5(query.encode()).hexdigest()
|
30 |
-
callback_data = f"audiodownload_{user_id}_{identifier}"
|
31 |
-
link_storage[callback_data] = query
|
32 |
-
return callback_data
|
33 |
|
34 |
@client.on_message(filters.command("start") & filters.private)
|
35 |
async def welcome_start(client: Client, message: Message):
|
@@ -37,7 +34,7 @@ async def welcome_start(client: Client, message: Message):
|
|
37 |
[
|
38 |
[
|
39 |
InlineKeyboardButton(
|
40 |
-
text="📢
|
41 |
url="https://t.me/RendyProjects"
|
42 |
)
|
43 |
]
|
@@ -48,27 +45,14 @@ async def welcome_start(client: Client, message: Message):
|
|
48 |
reply_markup=keyboard
|
49 |
)
|
50 |
|
51 |
-
@client.on_callback_query(filters.regex("^audiodownload_"))
|
52 |
-
async def callback_button(client: Client, cb: CallbackQuery):
|
53 |
-
try:
|
54 |
-
data = cb.data
|
55 |
-
user_id = cb.from_user.id
|
56 |
-
query = link_storage.get(data)
|
57 |
-
if query:
|
58 |
-
response = await Tiktok.download(tt, query)
|
59 |
-
await client.send_audio(user_id, response[1])
|
60 |
-
await cb.answer("Audio sent successfully!")
|
61 |
-
else:
|
62 |
-
await cb.answer("Invalid or expired link.", show_alert=True)
|
63 |
-
except Exception as e:
|
64 |
-
await cb.answer(f"Error: {str(e)}", show_alert=True)
|
65 |
-
|
66 |
@client.on_message(filters.text & filters.private)
|
67 |
async def tiktok_downloader(client: Client, message: Message):
|
68 |
if message.text:
|
69 |
query = message.text
|
70 |
-
|
71 |
-
|
|
|
|
|
72 |
callback_data = generate_callback_data(message.from_user.id, query)
|
73 |
keyboard = InlineKeyboardMarkup(
|
74 |
[
|
|
|
2 |
from pyrogram import Client, filters
|
3 |
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
|
4 |
from pyrogram.types import *
|
5 |
+
import akenoai as ak
|
6 |
+
from config import TIKTOK_WEB API_ID, API_HASH, BOT_TOKEN
|
7 |
import hashlib
|
8 |
|
9 |
logging.getLogger("pyrogram").setLevel(logging.WARNING)
|
|
|
11 |
|
12 |
WELCOME_TEXT = """
|
13 |
Halo {}
|
14 |
+
Saya adalah bot untuk mengunduh video PornoHub di telegram.
|
15 |
|
16 |
+
- Dilarang Keras spam
|
17 |
+
- Jangan share video ke group (mending private bot aman)
|
18 |
+
|
19 |
+
Powered by @xtdevs
|
20 |
"""
|
21 |
|
22 |
client = Client(
|
23 |
+
"AkenoHub",
|
24 |
api_id=API_ID,
|
25 |
api_hash=API_HASH,
|
26 |
bot_token=BOT_TOKEN
|
27 |
)
|
28 |
|
29 |
+
api = ak.PornoHub(key="randigithub356")
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
@client.on_message(filters.command("start") & filters.private)
|
32 |
async def welcome_start(client: Client, message: Message):
|
|
|
34 |
[
|
35 |
[
|
36 |
InlineKeyboardButton(
|
37 |
+
text="📢 Channel",
|
38 |
url="https://t.me/RendyProjects"
|
39 |
)
|
40 |
]
|
|
|
45 |
reply_markup=keyboard
|
46 |
)
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
@client.on_message(filters.text & filters.private)
|
49 |
async def tiktok_downloader(client: Client, message: Message):
|
50 |
if message.text:
|
51 |
query = message.text
|
52 |
+
response = await api.x_search(query=query)
|
53 |
+
link = response[0]
|
54 |
+
file_path, _, _, = await api.x_download(url=link, is_stream=True)
|
55 |
+
|
56 |
callback_data = generate_callback_data(message.from_user.id, query)
|
57 |
keyboard = InlineKeyboardMarkup(
|
58 |
[
|