postaddictme / instagram-php-scraper

Get account information, photos, videos, stories and comments.
https://packagist.org/packages/raiym/instagram-php-scraper
MIT License
3.08k stars 798 forks source link

No route to host #55

Closed MUTOgen closed 7 years ago

MUTOgen commented 7 years ago

I tried to use component in cron to update several accounts.

I got error of Unirest/Request Failed connect to www.instagram.com:443; No route to host pretty frequently

Why does it happen?

raiym commented 7 years ago

Hello! Don't know

How frequently cron job executes?

Please provide code snippets.

MUTOgen commented 7 years ago

Actually i use 2 types of cron jobs. To update user's profile (each 24 hours) and to update media info (each 30 mins).

But also i use console command to load new accounts, may be once a day or 2 days. During this command i have this error, so i need to re-execute command and it continues job.

Code not so complicated

foreach(...){
$insta_account = Instagram::getAccount($convertedText);
echo "Data from Instagram recieved...\r\n";
///....save to db....////
}

As i know you don't use it for big amount of operations, but may be you have an idea how to fix this problem.

raiym commented 7 years ago

Maybe adding random sleep after every API call may help?

On Dec 24, 2016 11:42, "Anton" notifications@github.com wrote:

Actually i use 2 types of cron jobs. To update user's profile (each 24 hours) and to update media info (each 30 mins).

But also i use console command to load new accounts, may be once a day or 2 days. During this command i have this errors, so i need to re-execute command and it continues job.

Code not so complicated

foreach(...){ $insta_account = Instagram::getAccount($convertedText); echo "Data from Instagram recieved...\r\n"; ///....save to db....//// }

As i now i don't use it for big amount of operations, but may be you have an idea how to fix this.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/postaddictme/instagram-php-scraper/issues/55#issuecomment-269075453, or mute the thread https://github.com/notifications/unsubscribe-auth/AFb0Gf17_Y4rtnPa6QJHWrfJS6U1mqFKks5rLNsFgaJpZM4LVE6n .

MUTOgen commented 7 years ago

@raiym may be... I will try it. But as i can imagine there are huge amount of user's requests coming each seconds, so my crons not a big deal... But who knows...

yura999999999 commented 7 years ago

+1, same issue

at localhost works fine, but does not work on a remote server

raiym commented 7 years ago

@yura999999999 maybe remote server is shared hosting and a lots of apps trying to reach instagram with same IP and instagram banned it (maybe temporary)

It is just hypothesis

yura999999999 commented 7 years ago

@raiym check it, tnx