Consider the case, I want to crawl websites frequently, but my IP address got blocked after some day/limit.
So, how can change my IP address dynamically or any other id
You can try using proxy servers to prevent being blocked. There are services providing working proxies. The best I tried is https://gimmeproxy.com - they frequently check proxies for various parameters.
In order to get proxy from them, you need just to make the following request:
https://gimmeproxy.com/api/getProxy
They will provide JSON response with all proxy data which you can use later as needed:
{
"supportsHttps": true,
"protocol": "socks5",
"ip": "179.162.22.82",
"port": "36915",
"get": true,
"post": true,
"cookies": true,
"referer": true,
"user-agent": true,
"anonymityLevel": 1,
"websites": {
"example": true,
"google": false,
"amazon": true
},
"country": "BR",
"tsChecked": 1517952910,
"curl": "socks5://179.162.22.82:36915",
"ipPort": "179.162.22.82:36915",
"type": "socks5",
"speed": 37.78,
"otherProtocols": {}
}
You can use it like this with Curl:
curl -x socks5://179.162.22.82:36915 http://example.com