Below is what you can do with this program:
- Get Instagram posts/profile/hashtag data without using Instagram API.
crawler.py
- Like posts automatically.
liker.py
This crawler could fail due to updates on instagram’s website. If you encounter any problems, please contact me.
- Make sure you have Chrome browser installed.
- Download chromedriver and put it into bin folder:
./inscrawler/bin/chromedriver
- Install Selenium:
pip install -r requirements.txt
cp inscrawler/secret.py.dist inscrawler/secret.py
positional arguments:
mode
options: [posts, posts_full, profile, hashtag]
optional arguments:
-h, --help show this help message and exit
-n NUMBER, --number NUMBER
number of returned posts
-u USERNAME, --username USERNAME
instagram's username
-t TAG, --tag TAG instagram's tag name
-o OUTPUT, --output OUTPUT
output file name(json format)
python crawler.py posts -u cal_foodie -n 100 -o ./output
python crawler.py posts_full -u cal_foodie -n 100 -o ./output
python crawler.py profile -u cal_foodie -o ./output
python crawler.py hashtag -t taiwan -o ./output
- Choose mode
posts
, you will get url, content, first photo for each post; choose modeposts_full
, you will get url, content, all photos, time, comments for each posts. Modeposts_full
will take way longer than modeposts
. - Return default 100 hashtag posts(mode: hashtag) and all user's posts(mode: posts) if not specifying the number of post
-n
,--number
. - Print the result to the console if not specifying the output path of post
-o
,--output
. - It takes much longer to get data if the post number is over about 1000 since Instagram has set up the rate limit for data request.
- Don't use this repo crawler Instagram if the user has more than 10000 posts.
The data format of posts_full
:
Set up your username/password in secret.py
or set them as environment variables.
positional arguments:
tag
optional arguments:
-n NUMBER, --number NUMBER (default 1000)
number of posts to like
python liker.py foodie