Rabbitgram is Instagram scrapper which you can get accounts informations and download accounts' photos/videos.
- Clone this repo,
- Install required libraries with pip,
- Start
rabbitgram_console.py
with python.
$ git clone https://github.com/serhattsnmz/rabbitgram.git
$ cd rabbitgram/
$ python -m pip install -r requirements.txt
$ python rabbitgram_console.py
usage: rabbitgram_console.py [-h] [-u] [-p] [-a] [-s] [--info] [--posts]
[--media] [-l] [-o] [--save] [--download]
[--video]
Rabbitgram : The Fastest Instagram Scraper
optional arguments:
-h, --help show this help message and exit
-u , --username User username
-p , --password User password
-a , --account Account username for scraping
-s , --settings The user settings file path
--info Get account general information
--posts Get user posts' information
--media Get user media information
-l , --list Download from account list file
-o , --output The file/directory path for saving result
--save Save the media or information
--download Download the media
--video Include videos for download. Default : False
To use rabbitgram, following parameters must be used for all commands.
Args | Required | Description |
---|---|---|
-u , --username |
Required | The username of the user who want to get information |
-p , --password |
Required | The password of the user who want to get information |
-a , --account |
Required | The instagram username who want to be scraped |
This parameters must be given either as argument at runtime or as variable in user settings file.
Rabbitgram can get account information such as followers, followed by etc.
Args | Required | Description |
---|---|---|
--info |
Required | Show account information |
--save |
Optional | Save information to file |
-o , --output |
Optional | Define file path. Used only with --save parameter |
Note: Output should be txt
file for better file view.
Example Usage:
$ python rabbitgram_console.py -s settings.yml -a insta.account --info
# Show information
$ python rabbitgram_console.py -s settings.yml -a insta.account --info --save
# Show information and save that to ./output.txt file
$ python rabbitgram_console.py -s settings.yml -a insta.account --info --save -o ./result.txt
# Show information and save that to ./result.txt file
Rabbitgram can get account all posts information with taken time, media urls etc.
Args | Required | Description |
---|---|---|
--posts |
Required | Show account posts' information |
--save |
Optional | Save information to file |
-o , --output |
Optional | Define file path. Used only with --save parameter |
Note: Output should be json
file for better file view.
Example Usage:
$ python rabbitgram_console.py -s settings.yml -a insta.account --posts
# Show posts' information
$ python rabbitgram_console.py -s settings.yml -a insta.account --posts --save
# Show information and save that to ./output.json file
$ python rabbitgram_console.py -s settings.yml -a insta.account --posts --save -o ./result.json
# Show information and save that to ./result.json file
Rabbitgram can download all posts or a certain number of posts media with/without video files.
Args | Required | Description |
---|---|---|
--media |
Required | Show only account posts' information |
--save |
Optional | Save all media links to file |
--download |
Optional | Download media and save to path |
-o , --output |
Optional | Define the download directory path |
--video |
Optional | Include videos. Default is not included |
Note: Output should be directory path, if you use --download
and should be json file path if you use --save
.
Example Usage:
$ python rabbitgram_console.py -s settings.yml -a insta.account --media
# Show account media information
$ python rabbitgram_console.py -s settings.yml -a insta.account --media --save
# Show information and save that to ./output.json file
$ python rabbitgram_console.py -s settings.yml -a insta.account --media --save -o ./result.json
# Show information and save that to ./result.json file
$ python rabbitgram_console.py -s settings.yml -a insta.account --media --download
# Download account images to ./insta.account directory path
$ python rabbitgram_console.py -s settings.yml -a insta.account --media --download -o ./downloads
# Download account images to ./downloads/insta.account directory path
$ python rabbitgram_console.py -s settings.yml -a insta.account --media --download --video
# Download account image and videos to ./insta.account directory path
This part is still under development...
If you prefer rabbitgram to get your information from file instead of parameters, you can create a settings file as yaml format.
Example yaml file must be like that :
username : user_username
password : user_s3cr3t_p4ss
account : the_account_name_wish_to_get_info
Remember that, none of the keys above is not required. You can define any of them and can give the others as parameter. Beside that, if you give a parameter which is already defined in settings file, rabbitgram will take the parameter instead of defination in the settings file.
After creating settings file, you can use it like that;
$ python rabbitgram_console.py -s ./user_settings.yml
$ python rabbitgram_console.py -s ./user_settings.yml -u new_username
$ python rabbitgram_console.py -s ./user_settings.yml -p new password
$ python rabbitgram_console.py -s ./user_settings.yml -u new_username -p new password
$ python rabbitgram_console.py -s ./user_settings.yml -a new_account
etc...
To create docker image, just run the following codes;
$ cd path/to/rabbitgram
$ docker build -t serhattsnmz/rabbitgram .
$ docker run -it --rm serhattsnmz/rabbitgram
Or, just download from docker hub;
$ docker pull serhattsnmz/rabbitgram
$ docker run -it --rm serhattsnmz/rabbitgram
You should create a directory for sharing data between docker container and your host machine. If you don't, you can see the output of the rabbitgram but all downloaded media or information files will delete after deleting container.
# Create folder
$ mkdir D:/shared-folder
# Give the shared folder name to rabbitgram container when using
$ docker run -it --rm -v D:/shared-folder:/app/shared-folder serhattsnmz/rabbitgram
You can store user settings file in this directory. If you do this, do not forget to give local path instead of your host machine path.
$ ls D:/shared-folder
user-settings.yml
$ docker run -it --rm -v D:/shared-folder:/app/shared-folder serhattsnmz/rabbitgram -s /app/shared-folder/user-settings.yml
Rabbitgram docker container can take all arguments mentioned above. Just do not forget to give local path instead of your host machine path.
Some usage examples;
docker run -it --rm -v D:/shared-folder:/app/shared-folder serhattsnmz/rabbitgram -u username -p password -a account
docker run -it --rm -v D:/shared-folder:/app/shared-folder serhattsnmz/rabbitgram -s /app/shared-folder/user-settings.yml
docker run -it --rm -v D:/shared-folder:/app/shared-folder serhattsnmz/rabbitgram -s /app/shared-folder/user-settings.yml --info
docker run -it --rm -v D:/shared-folder:/app/shared-folder serhattsnmz/rabbitgram -s /app/shared-folder/user-settings.yml --media --download -o /app/shared-folder
docker run -it --rm -v D:/shared-folder:/app/shared-folder serhattsnmz/rabbitgram -s /app/shared-folder/user-settings.yml --posts --save -o /app/shared-folder/info.json