Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDarkW3b authored May 30, 2020
0 parents commit 94f5319
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: python main.py
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# [Instagram Downloader](https://t.me/)

Its Source Of [@](https://t.me/) .This Bot Helps In Downloading __Instagram Photos__ and __Videos__ Using IG Public API. For Now It Works Only For **Public Accounts**. No Login or Money Required Just send The Instagram Post Link to Bot, It Will Send Video/Photo In Return.

## Requirements

> python-telegram-bot
> requests
---

## Setup

To Make Your Own Bot Using This Source. Follow Below Steps

> Go To [@BotFather](https://t.me/botfather) and Collect Your Bot Token

### Setup using Heroku

* Fork This Repo
* Open main.py and Paste Your Bot Token in __TOKEN__ Variable
* Make Account On Heroku.com
* Click New App
* Give Name To Your App of Your Choice
* Connect Heroku To Your Github By Clicking Deploy and then Deployment method in Your Heroku app
* Search Your Forked Repo Name
* Click Deploy, Wait Till Deployment
* Go To Dynos, Turn It On and Check Your Bot

### Locally Running On Server

* Fork This Repo
* Open main.py and Paste Your Bot Token in __TOKEN__ Variable
* Download This Repo
* On Terminal run Command
'''
pip install -r requirements.txt
'''
'''
python main.py
'''
---

## Credits

> Its Written by [@TheDarkW3b](https://t.me/TheDarkW3b)
> Support Group :- https://t.me/Technology_Arena
> Channel :- https://t.me/Dark_Hacker_X
73 changes: 73 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
# DONT_REMOVE_THIS
# TheDarkW3b (c)

from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from telegram import ParseMode
import logging
import requests
import json

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',

level=logging.INFO)

#Logger Setup
logger = logging.getLogger(__name__)

TOKEN = "YOUR_TOKEN_HERE"

def download(bot, update):
message = update.effective_message
instagram_post = message.text
if instagram_post=="/start":
bot.send_chat_action(chat_id=update.message.chat_id, action="typing")
update.message.reply_text("❤️ Thanks For Using Me Just Send Me The Link In Below Format \n🔥 Format :- https://www.instagram.com/p/B4zvXCIlNTw/ \nVideos Must Be Less Then 20MB, For Now It Cannot Support Long IGTV Videos \n\n<b>Support Group :-</b> @Technology_Arena \n<b>🌀 Source</b> \nhttps://github.com/TheDarkW3b/instagram", parse_mode=ParseMode.HTML, disable_web_page_preview=True)
else:
pass
if "instagram.com" in instagram_post:
if instagram_post.endswith("/"):
pass
else:
bot.send_chat_action(chat_id=update.message.chat_id, action="typing")
bot.sendMessage(chat_id=update.message.chat_id, text="♨️ Link of Public Post Must End with / \nIt Should Be In Below Format \n<b>Format :-</b> https://www.instagram.com/p/B4zvXCIlNTw/ ", parse_mode=ParseMode.HTML, disable_web_page_preview=True)
return
url = instagram_post + "?__a=1"
try:
visit = requests.get(url).json()
checking_video = visit['graphql']['shortcode_media']['is_video']
except:
bot.sendMessage(chat_id=update.message.chat_id, text="Send Me Only Public Instagram Posts ⚡️")

if checking_video==True:
try:
video_url = visit['graphql']['shortcode_media']['video_url']
bot.send_chat_action(chat_id=update.message.chat_id, action="upload_video")
bot.sendVideo(chat_id=update.message.chat_id, video=video_url)
except:
pass

elif checking_video==False:
try:
post_url = visit['graphql']['shortcode_media']['display_url']
bot.send_chat_action(chat_id=update.message.chat_id, action="upload_photo")
bot.sendPhoto(chat_id=update.message.chat_id, photo=post_url)
except:
pass
else:
bot.send_chat_action(chat_id=update.message.chat_id, action="typing")
bot.sendMessage(chat_id=update.message.chat_id, text="I Cant Send You Private Posts :-( ")
else:
bot.sendMessage(chat_id=update.message.chat_id, text="Kindly Send Me Public Instagram Video/Photo Url")

def main():
updater = Updater(TOKEN)
dp = updater.dispatcher
logger.info("Setting Up MessageHandler")
dp.add_handler(MessageHandler(Filters.text, download))
updater.start_polling()
logging.info("Starting Long Polling!")
updater.idle()

if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python-telegram-bot
requests
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.8.2

0 comments on commit 94f5319

Please sign in to comment.