No response when trying to run Python proxies

Asked

Viewed 58 times

0

I’m trying to write a code to make my own Scrapping on the Web and I’m trying to implement the proxy rotation, but I’m not getting any results. I’ve checked many websites and forums about this problem, but I can’t make it work. Here is part of the code I’m using, the list of proxies comes from the site https://www.sslproxies.org/

p = get_proxies()
p_pool = cycle(p)
url = 'https://youtube.com'

for i in range(1,50):
    proxy = next(p_pool)
    print("request #%d"%i, proxy)
    try:
        response = requests.request(url, proxies={"https": proxy, "http": proxy}, timeout=10)
        print(response.json())
    except:
        print("Skipping. Connection error")

I always get the same error message:

request #1 118.200.73.124:8080
Skipping. Connection error
request #2 103.242.44.80:8080
Skipping. Connection error
request #3 82.200.233.4:3128
Skipping. Connection error
request #4 109.75.47.248:53422
Skipping. Connection error
request #5 181.117.176.236:61358
Skipping. Connection error

How can I make this code work?

Thank you very much!

  • What libs are you using?

  • import requests from bs4 import Beautifulsoup as Bs from itertools import Cycle import traceback

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.