Repository navigation
Open
Description
Proof https://replit.com/@d3banjan/KhakiStarchyCustomer#main.py
The following code fails ---
from random import choice
from http_request_randomizer.requests.proxy.requestProxy import RequestProxy
proxies = RequestProxy().get_proxy_list()
PROXY = choice(proxies).get_address()
print(PROXY, type(PROXY))
... with the following error message --
2021-08-18 10:14:57,091 http_request_randomizer.requests.useragent.userAgent INFO Using local file for user agents: /opt/virtualenvs/python3/lib/python3.8/site-packages/http_request_randomizer/requests/proxy/../data/user_agents.txt
2021-08-18 10:14:57,093 root DEBUG === Initialized Proxy Parsers ===
2021-08-18 10:14:57,093 root DEBUG FreeProxy parser of 'http://free-proxy-list.net' with required bandwidth: '150' KBs
2021-08-18 10:14:57,093 root DEBUG PremProxy parser of 'https://premproxy.com/list/' with required bandwidth: '150' KBs
2021-08-18 10:14:57,093 root DEBUG SslProxy parser of 'https://www.sslproxies.org' with required bandwidth: '150' KBs
2021-08-18 10:14:57,093 root DEBUG =================================
2021-08-18 10:14:57,525 http_request_randomizer.requests.parsers.FreeProxyParser ERROR Provider FreeProxy failed with Attribute error: 'NoneType' object has no attribute 'find'
2021-08-18 10:14:57,526 root DEBUG Added 0 proxies from FreeProxy
2021-08-18 10:14:58,051 http_request_randomizer.requests.parsers.PremProxyParser WARNING Proxy Provider url failed: https://premproxy.com/list/
2021-08-18 10:14:58,051 http_request_randomizer.requests.parsers.PremProxyParser DEBUG Pages: set()
2021-08-18 10:14:58,465 http_request_randomizer.requests.parsers.PremProxyParser WARNING Proxy Provider url failed: https://premproxy.com/list/
2021-08-18 10:14:58,466 root DEBUG Added 0 proxies from PremProxy
2021-08-18 10:14:58,792 http_request_randomizer.requests.parsers.SslProxyParser ERROR Provider SslProxy failed with Attribute error: 'NoneType' object has no attribute 'find'
2021-08-18 10:14:58,792 root DEBUG Added 0 proxies from SslProxy
2021-08-18 10:14:58,792 root DEBUG Total proxies = 0
2021-08-18 10:14:58,792 root DEBUG Filtered proxies = 0
Traceback (most recent call last):
File "main.py", line 4, in <module>
proxies = RequestProxy().get_proxy_list()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/http_request_randomizer/requests/proxy/requestProxy.py", line 69, in __init__
self.current_proxy = self.randomize_proxy()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/http_request_randomizer/requests/proxy/requestProxy.py", line 86, in randomize_proxy
raise ProxyListException("list is empty")
http_request_randomizer.requests.errors.ProxyListException.ProxyListException: list is empty
Metadata
Metadata
Assignees
Labels
No labels
Activity
pgaref commentedon Aug 18, 2021
Looks like the existing proxy providers (premproxy, FreeProxy, SslProxy) changed some html attributes and we cannot parse them anymore -- thus the ProxyListException: list is empty
This will require some parser rework
d3banjan commentedon Aug 18, 2021
HTTP_Request_Randomizer/http_request_randomizer/requests/parsers/FreeProxyParser.py
Line 27 in 5c41348
For those who are interested, removing the
attrsfilter works as a short term workaround,This is because FreeProxy hasn't changed anything and
findgets the first table.guerradesouza commentedon Sep 20, 2021
@d3banjan it not worked to me. Anyone did can to resolve "list empty"?
metegenez commentedon Oct 3, 2021
making
table = soup.find("table", attrs={"id": "proxylisttable"})table = soup.find("table", attrs={"class": "table table-striped table-bordered"})works for FreeProxy.
akashgoyal119 commentedon Oct 30, 2021
Had same problem, @metegenez solution worked for me
JasonBristol commentedon Dec 1, 2021
@metegenez solution works for FreeProxy and SslProxy
For PremProxy, it looks like they setup CORS and user agent checks, you can bypass it by spoofing the origin and referer headers, and leveraging a random user agent
In UnPacker.py make the following changes
In PremProxyParse.py make the following changes
def parse_proxyList(self): curr_proxy_list = [] try: # Parse all proxy pages -> format: /list/{num}.htm # Get the pageRange from the 'pagination' table page_set = self.get_pagination_set() logger.debug("Pages: {}".format(page_set)) # One JS unpacker per provider (not per page) self.js_unpacker = self.init_js_unpacker() for page in page_set: + response = requests.get("{0}{1}".format(self.get_url(), page), timeout=self.timeout, headers=self.headers) if not response.ok:def get_pagination_set(self): + response = requests.get(self.get_url(), timeout=self.timeout, headers=self.headers) page_set = set() # Could not parse pagination page - Let user know if not response.ok: logger.warning("Proxy Provider url failed: {}".format(self.get_url()) return page_set