huaying / instagram-crawler

Get Instagram posts/profile/hashtag data without using Instagram API
MIT License
1.17k stars 287 forks source link

AttributeError: 'NoneType' object has no attribute 'send_keys' #113

Open katrikken opened 3 years ago

katrikken commented 3 years ago

Hi, I am trying to run a simple request on one of my own accounts (username and password of another account) like this:

python crawler.py posts_full -u katrikken -n 1

And I get an error:

Traceback (most recent call last): File "crawler.py", line 83, in args.username, args.number, args.mode == "posts_full", args.debug File "crawler.py", line 27, in get_posts_by_user ins_crawler = InsCrawler(has_screen=debug) File "C:\Users\kurys\IdeaProjects\myprojects\instagram-crawler-master\inscrawler\crawler.py", line 70, in init self.login() File "C:\Users\kurys\IdeaProjects\myprojects\instagram-crawler-master\inscrawler\crawler.py", line 82, in login u_input.send_keys(secret.username) AttributeError: 'NoneType' object has no attribute 'send_keys'

Could you please help me out why is it falling?

I renamed secret.py.dist to secret.py and the contents look like this:

----------start of contents----------- import os

username = os.environ.get('USERNAME', 'katrikken_dancing') password = os.environ.get('PASSWORD', '**') -----------end of contents----------- Thank you!

Cocytusi commented 3 years ago

I have the same problem with you

ege-del commented 3 years ago

Looks like Instagram detects the headless selenium driver and redirects to a page with message "Please wait a few minutes before you try again". If you add the parameter --debug it works as expected because driver is not running on headless mode when --debug parameter is active

SuhyunL commented 3 years ago

@ege-del Your code worked for me. Thank you for sharing!