Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh proxy list from webshare every 20 minutes #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alif-munim
Copy link

@alif-munim alif-munim commented Jul 5, 2021

Contribution

I've created a python script to make things easiers for users who have their WebShare proxy list refresh periodically. The script periodically downloads a user's proxy list from WebShare every 20 minutes to config/proxies.txt and reformats each proxy address to username:password@ip:host form. Any feedback would be appreciated :)

WebShare Proxy List API
In your WebShare dashboard, click Download Proxy List
image


Then, copy the Proxy List API URL:
image

Setup

🔧 Below is the setup process for the proxy-refresh.py file.

Change the url variable here to your WebShare Proxy List API url:

def get_proxies():
    dir_path = os.path.dirname(os.path.realpath(__file__))
    url = 'your-webshare-url'
    filename = dir_path + '/' + 'config' + '/' + 'proxies.txt'

Adjust the regex pattern using the username and password values from your WebShare dashboard:

pattern = re.compile("(^.*)(:)(username:password)")

If you'd like to adjust the scheduling interval, you can do so by changing 20 to some other value here:

schedule.every(20).minutes.do(get_proxies)
while 1:
    schedule.run_pending()
    time.sleep(1)

Run Script

Finally, you can run the script using the following command:

> python3 proxy-refresh.py

💡 Congratulations! Your proxy list will automatically refresh every 20 minutes.

@Prince25
Copy link
Owner

Hey @alif-munim, thanks for your contribution!
Sorry for the super late feedback. Excuse my ignorance, but doesn't Webshare allow you to use a rotating proxy that essentially fixes the issue you're trying to solve. They provide you with one proxy endpoint which assigns a random IP address from your proxy list. Plus, it gives you the option to rotate and refresh that proxy list. You can simply place that one proxy endpoint in config/proxies.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants