12 982
درود به کاربران فرشتگان ژرف 👋
امروز با یک کد بسیار ساده و جذاب در خدمت شما هستیم که میتواند با استفاده از لینک اینستاگرام و استوری اینستاگرام ان هه را دانلود و ارسال کند🤓
بسیار ساده و جذاب است و در عینحال میبایسد که api برای دانلود داشته باشید وگرنه دکمه ها کار نمیکنند!🤬
میتوانید api خود را در لاین چهارم جلوی $instagramApiUrl قرار دهید😜
کد کامل :
<?php
$token = "YOUR_BOT_TOKEN";
$apiUrl = "https://api.telegram.org/bot$token/";
$instagramApiUrl = "YOUR_INSTAGRAM_API_URL";
$update = json_decode(file_get_contents("php://input"), true);
$message = $update['message'];
$callbackQuery = $update['callback_query'];
if (isset($message['text']) && $message['text'] == '/start') {
$chatId = $message['chat']['id'];
$welcomeMessage = "به ربات ما خوش آمدید!
@AbyssalSeraphs";
$keyboard = [
'inline_keyboard' => [
[
['text' => 'دانلود پست', 'callback_data' => 'download_post'],
['text' => 'دانلود استوری', 'callback_data' => 'download_story'],
],
],
];
$replyMarkup = json_encode($keyboard);
file_get_contents($apiUrl . "sendMessage?chat_id=$chatId&text=$welcomeMessage&reply_markup=$replyMarkup");
}
if (isset($callbackQuery)) {
$chatId = $callbackQuery['message']['chat']['id'];
$data = $callbackQuery['data'];
if ($data == 'download_post') {
$responseMessage = "لطفاً لینک پست اینستاگرامی را ارسال کنید:";
file_get_contents($apiUrl . "sendMessage?chat_id=$chatId&text=$responseMessage");
} elseif ($data == 'download_story') {
$responseMessage = "لطفاً لینک استوری اینستاگرامی را ارسال کنید:";
file_get_contents($apiUrl . "sendMessage?chat_id=$chatId&text=$responseMessage");
}
}
if (isset($message['text'])) {
$chatId = $message['chat']['id'];
if (preg_match("/https?:\/\/(www\.)?instagram\.com\/p\/([a-zA-Z0-9_-]+)/", $message['text'], $matches)) {
$postUrl = $matches[0];
$downloadedFile = downloadInstagramPost($postUrl);
if ($downloadedFile) {
$filePath = new CURLFile($downloadedFile);
file_get_contents($apiUrl . "sendDocument?chat_id=$chatId&document=" . $filePath);
} else {
file_get_contents($apiUrl . "sendMessage?chat_id=$chatId&text=متاسفانه، نتوانستم پست را دانلود کنم.");
}
}
if (preg_match("/https?:\/\/(www\.)?instagram\.com\/stories\/([a-zA-Z0-9_-]+)/", $message['text'], $matches)) {
$storyUrl = $matches[0];
$downloadedFile = downloadInstagramStory($storyUrl);
if ($downloadedFile) {
$filePath = new CURLFile($downloadedFile);
file_get_contents($apiUrl . "sendDocument?chat_id=$chatId&document=" . $filePath);
} else {
file_get_contents($apiUrl . "sendMessage?chat_id=$chatId&text=متاسفانه، نتوانستم استوری را دانلود کنم.");
}
}
}
function downloadInstagramPost($url) {
global $instagramApiUrl;
return "path/to/downloaded/post.jpg";
}
function downloadInstagramStory($url) {
global $instagramApiUrl;
return "path/to/downloaded/story.jpg";
}
?>21 9月 2024, 15:29
17 11月 2024, ~05:26
