NEP DEVS
رفتن به کانال در Telegram
NEPS DEV WHO WANT TO HELP YOU WITH FOSS PROJECT. WE COLLECT SCRIPTS THIS GROUP IS ONLY FOR EDUCATIONAL PURPOSE
نمایش بیشتراطلاعاتی وجود ندارد
مشترکین
-3724 ساعت
-1357 روز
-23530 روز
آرشیو پست ها
Title: WikiPedia API: Seamless Information Retrieval and Display
API PURPOSE: 📚🔍 Facilitates easy access to wikipedia content, allowing users to retrieve information effortlessly. Offers a structured way to fetch and display specific wiki entries.
USAGE: 🔍📖 Construct a URL using the "wiki" parameter to access desired wiki entries conveniently. Specify the topic to retrieve relevant information effortlessly.
EXAMPLE: 🌐 Use:
https://wikipedia.apinepdev.workers.dev/?wiki=hello
PROCESSING: ⚙️ Utilizes a streamlined process to fetch and display wiki content based on the specified query, ensuring accurate and relevant information retrieval.
RESPONSE: 📝✨ Obtain the requested wiki information, making it easier to display and utilize wiki content. Ideal for integrating wiki data into applications or websites seamlessly.
🧑💻 MADE BY NEP CODER
JOIN: @DEVSNP
Enjoy and Use in Your Awesome Project😍
By @Devsnpimport os
import base64
import hashlib
import requests
import time
from telebot import TeleBot
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
bot = TeleBot(token='YourBottoken') #botoken
API_KEY = "Your Remini Api Token" #remini api
CONTENT_TYPE = "image/jpeg"
_TIMEOUT = 60
_BASE_URL = "https://developer.remini.ai/api"
def _get_image_md5_content(file_path: str) -> tuple[str, bytes]:
with open(file_path, "rb") as fp:
content = fp.read()
image_md5 = base64.b64encode(hashlib.md5(content).digest()).decode("utf-8")
return image_md5, content
def enhance_photo_and_send_link(file_path: str, chat_id: int):
image_md5, content = _get_image_md5_content(file_path)
with requests.Session() as session:
session.headers.update({"Authorization": f"Bearer {API_KEY}"})
response = session.post(
f"{_BASE_URL}/tasks",
json={
"tools": [
{"type": "face_enhance", "mode": "beautify"},
{"type": "background_enhance", "mode": "base"}
],
"image_md5": image_md5,
"image_content_type": CONTENT_TYPE
}
)
assert response.status_code == 200
body = response.json()
task_id = body["task_id"]
response = session.put(
body["upload_url"],
headers=body["upload_headers"],
data=content,
timeout=_TIMEOUT
)
assert response.status_code == 200
response = session.post(f"{_BASE_URL}/tasks/{task_id}/process")
assert response.status_code == 202
for i in range(50):
response = session.get(f"{_BASE_URL}/tasks/{task_id}")
assert response.status_code == 200
if response.json()["status"] == "completed":
break
else:
time.sleep(2)
output_url = response.json()["result"]["output_url"]
bot.send_photo(chat_id, output_url)
os.remove(file_path)
@bot.message_handler(commands=['start'])
def start_command(message):
keyboard = InlineKeyboardMarkup(row_width=2)
dev_button = InlineKeyboardButton("Developer 👨💻", url="https://t.me/devsno")
update_button = InlineKeyboardButton("Update ✅", url="https://t.me/devsnp")
keyboard.add(dev_button, update_button)
welcome_message = """
<b>Welcome to Remini Enhancer Telegram Bot.</b>
Please send me a photo to enhance.
"""
bot.send_message(
message.chat.id,
welcome_message,
parse_mode='html',
reply_markup=keyboard
)
@bot.message_handler(content_types=['photo'])
def handle_photo(message):
photo = message.photo[-1]
file_path = os.path.join(os.getcwd(), f"{photo.file_unique_id}.jpg")
file_info = bot.get_file(photo.file_id)
file = requests.get(f'https://api.telegram.org/file/bot{bot.token}/{file_info.file_path}')
with open(file_path, 'wb') as new_file:
new_file.write(file.content)
bot.send_message(message.chat.id, "<b>Enhancing your photo...</b>", parse_mode='html')
enhance_photo_and_send_link(file_path, message.chat.id)
@bot.message_handler(func=lambda message: True)
def handle_invalid_message(message):
bot.send_message(message.chat.id, "<b>I am not allowed to receive any text messages or emojis.</b>\n\n<b>Please send only photos.</b>", parse_mode='html')
if __name__ == '__main__':
bot.polling(none_stop=True)
Remini Image enhance Telegram❤️❤️ Bot python Codes
Note:-codes is not made By me
but ye aiogram Me tha to Telebot me Banadiya
It is Github Project By Others Pro Devs But I modified With Telebot So Enjoy
So enjoy 😁😁
by @devsnp