Skip to content

Commit

Permalink
Merge pull request #138 from phenobarbital/new-version
Browse files Browse the repository at this point in the history
new proxy service added
  • Loading branch information
phenobarbital authored Sep 19, 2024
2 parents f010714 + 08f23d9 commit a449dce
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
18 changes: 18 additions & 0 deletions examples/test_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import asyncio
from proxylists.proxies import ProxyWorld


async def proxy_list():
proxies = await ProxyWorld().get_list()
for p in proxies:
print(p)
return proxies


def get_proxies():
loop = asyncio.get_event_loop()
return loop.run_until_complete(proxy_list())


if __name__ == "__main__":
get_proxies()
1 change: 1 addition & 0 deletions proxylists/proxies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .freeproxy import FreeProxy
from .proxydb import ProxyDB
from .hidemy import Hidemy
from .proxyworld import ProxyWorld

__all__ = ["FreeProxy", "Hidemy", "ProxyDB"]

Expand Down
28 changes: 28 additions & 0 deletions proxylists/proxies/proxyworld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://www.freeproxy.world/


from .server import ProxyServer


class ProxyWorld(ProxyServer):
url = "https://www.freeproxy.world/?country=US"
table_attribute: str = 'layui-table'
table_param: str = 'class'

async def get_proxies(self):
proxies = []
try:
path = f'//table[@{self.table_param}="{self.table_attribute}"]'
table = self.parser.xpath(path)[0]
except IndexError as err:
print(err)
return []
for i in table.xpath("//tbody/tr")[:10]:
if i.xpath('.//td[6]//a[contains(text(),"http")]'):
ip = i.xpath('.//td[1]/text()')[0].strip()
port = i.xpath('.//td[2]//a/text()')[0].strip()
proxy = ":".join(
[ip, port]
)
proxies.append(proxy)
return proxies
2 changes: 1 addition & 1 deletion proxylists/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__title__ = 'proxylists'
__description__ = ('Package for getting useful proxy servers, '
'can use lists like hidemy or proxydb.')
__version__ = '0.12.5'
__version__ = '0.13.1'
__author__ = 'Jesus Lara'
__author_email__ = '[email protected]'
__license__ = 'BSD'

0 comments on commit a449dce

Please sign in to comment.