-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from my-dev-app/feature/additional_proxy_lists
Feature/additional proxy lists
- Loading branch information
Showing
14 changed files
with
333 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
""" | ||
░░ ░░ ░░ ░░░ ░░ ░░░░ ░ ░░░░ ░ ░░ ░ ░░░░░░░░ ░░ ░░░░ ░ | ||
▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒ ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ | ||
▓ ▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ | ||
█ █ ███████ ███ ██ ████ ██ ██ █████ ████ ███ ██ ███████ ███████ ████ ████ | ||
█ ████ █ ███████ ████ ██ ██ ████ ████ ████ ████ █ █ █ ████ ████ ████ | ||
By undeƒined | ||
------------ | ||
Main parser example, other parsers can inherit from this class | ||
""" | ||
from queue import Queue | ||
|
||
from .parser import MainScraper | ||
|
||
|
||
class ParserGeonodeProxy(MainScraper): | ||
def __init__(self) -> None: | ||
MainScraper.__init__(self) | ||
self.zone = None | ||
|
||
@classmethod | ||
async def format_url(cls, url, *args, **kwargs) -> str: | ||
"""Formats URL before scraping, let us adjust query parameters for each parser""" | ||
cls.zone = kwargs.get("country", "US") | ||
return url.replace('country=US', f'country={cls.zone.upper()}') | ||
|
||
@classmethod | ||
async def format_raw(cls, html: str) -> list: | ||
"""Parse text/html pages, customized method for the parser of this website""" | ||
return | ||
|
||
@classmethod | ||
async def format_data(cls, zone: str, data: dict, queue: Queue) -> None: | ||
"""Data formatter, formats data and returns is back in the process Queue""" | ||
for item in data['data']: | ||
queue.put( | ||
{ | ||
'zone': zone.upper(), | ||
'method': item['protocols'][0], | ||
'anonymity': 'unknown', | ||
'protocol': item['protocols'][0], | ||
'port': item['port'], | ||
'ip': item['ip'] | ||
} | ||
) | ||
return queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
""" | ||
░░ ░░ ░░ ░░░ ░░ ░░░░ ░ ░░░░ ░ ░░ ░ ░░░░░░░░ ░░ ░░░░ ░ | ||
▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒ ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ | ||
▓ ▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ | ||
█ █ ███████ ███ ██ ████ ██ ██ █████ ████ ███ ██ ███████ ███████ ████ ████ | ||
█ ████ █ ███████ ████ ██ ██ ████ ████ ████ ████ █ █ █ ████ ████ ████ | ||
By undeƒined | ||
------------ | ||
Main parser example, other parsers can inherit from this class | ||
""" | ||
from queue import Queue | ||
|
||
from .parser import MainScraper | ||
|
||
|
||
class ParserScraperComProxy(MainScraper): | ||
def __init__(self) -> None: | ||
MainScraper.__init__(self) | ||
self.zone = None | ||
|
||
@classmethod | ||
async def format_url(cls, url, *args, **kwargs) -> str: | ||
"""Formats URL before scraping, let us adjust query parameters for each parser""" | ||
cls.zone = kwargs.get("country", "us") | ||
return url | ||
|
||
@classmethod | ||
async def format_raw(cls, html: str) -> list: | ||
"""Parse text/html pages, customized method for the parser of this website""" | ||
result = [] | ||
data = html.split('\r\n') | ||
for proxy in data: | ||
if proxy: | ||
protocol = proxy.split('://')[0] | ||
ip = proxy.split('://')[1].split(':')[0] | ||
port = proxy.split('://')[1].split(':')[-1] | ||
result.append({ | ||
'zone': cls.zone.upper(), | ||
'method': protocol, | ||
'anonymity': 'unknown', | ||
'protocol': protocol, | ||
'port': port, | ||
'ip': ip | ||
}) | ||
return result | ||
|
||
@classmethod | ||
async def format_data(cls, zone: str, data: dict, queue: Queue) -> None: | ||
"""Data formatter, formats data and returns is back in the process Queue""" | ||
queue.put(data) | ||
return queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
""" | ||
░░ ░░ ░░ ░░░ ░░ ░░░░ ░ ░░░░ ░ ░░ ░ ░░░░░░░░ ░░ ░░░░ ░ | ||
▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒ ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ | ||
▓ ▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ | ||
█ █ ███████ ███ ██ ████ ██ ██ █████ ████ ███ ██ ███████ ███████ ████ ████ | ||
█ ████ █ ███████ ████ ██ ██ ████ ████ ████ ████ █ █ █ ████ ████ ████ | ||
By undeƒined | ||
------------ | ||
Main parser example, other parsers can inherit from this class | ||
""" | ||
from queue import Queue | ||
|
||
from .parser import MainScraper | ||
|
||
|
||
class ParserTheSpeedHTTPProxy(MainScraper): | ||
def __init__(self) -> None: | ||
MainScraper.__init__(self) | ||
self.zone = None | ||
|
||
@classmethod | ||
async def format_url(cls, url, *args, **kwargs) -> str: | ||
"""Formats URL before scraping, let us adjust query parameters for each parser""" | ||
cls.zone = kwargs.get("country", "us") | ||
return url | ||
|
||
@classmethod | ||
async def format_raw(cls, html: str) -> list: | ||
"""Parse text/html pages, customized method for the parser of this website""" | ||
result = [] | ||
data = html.split('\n') | ||
for proxy in data: | ||
if proxy: | ||
protocol = 'http' | ||
ip = proxy.split(':')[0] | ||
port = proxy.split(':')[-1] | ||
result.append({ | ||
'zone': cls.zone.upper(), | ||
'method': protocol, | ||
'anonymity': 'unknown', | ||
'protocol': protocol, | ||
'port': port, | ||
'ip': ip | ||
}) | ||
return result | ||
|
||
@classmethod | ||
async def format_data(cls, zone: str, data: dict, queue: Queue) -> None: | ||
"""Data formatter, formats data and returns is back in the process Queue""" | ||
queue.put(data) | ||
return queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
""" | ||
░░ ░░ ░░ ░░░ ░░ ░░░░ ░ ░░░░ ░ ░░ ░ ░░░░░░░░ ░░ ░░░░ ░ | ||
▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒ ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ | ||
▓ ▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ | ||
█ █ ███████ ███ ██ ████ ██ ██ █████ ████ ███ ██ ███████ ███████ ████ ████ | ||
█ ████ █ ███████ ████ ██ ██ ████ ████ ████ ████ █ █ █ ████ ████ ████ | ||
By undeƒined | ||
------------ | ||
Main parser example, other parsers can inherit from this class | ||
""" | ||
from queue import Queue | ||
|
||
from .parser import MainScraper | ||
|
||
|
||
class ParserTheSpeedSock4Proxy(MainScraper): | ||
def __init__(self) -> None: | ||
MainScraper.__init__(self) | ||
self.zone = None | ||
|
||
@classmethod | ||
async def format_url(cls, url, *args, **kwargs) -> str: | ||
"""Formats URL before scraping, let us adjust query parameters for each parser""" | ||
cls.zone = kwargs.get("country", "us") | ||
return url | ||
|
||
@classmethod | ||
async def format_raw(cls, html: str) -> list: | ||
"""Parse text/html pages, customized method for the parser of this website""" | ||
result = [] | ||
data = html.split('\n') | ||
for proxy in data: | ||
if proxy: | ||
protocol = 'http' | ||
ip = proxy.split(':')[0] | ||
port = proxy.split(':')[-1] | ||
result.append({ | ||
'zone': cls.zone.upper(), | ||
'method': protocol, | ||
'anonymity': 'unknown', | ||
'protocol': protocol, | ||
'port': port, | ||
'ip': ip | ||
}) | ||
return result | ||
|
||
@classmethod | ||
async def format_data(cls, zone: str, data: dict, queue: Queue) -> None: | ||
"""Data formatter, formats data and returns is back in the process Queue""" | ||
queue.put(data) | ||
return queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
""" | ||
░░ ░░ ░░ ░░░ ░░ ░░░░ ░ ░░░░ ░ ░░ ░ ░░░░░░░░ ░░ ░░░░ ░ | ||
▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒▒ ▒▒ ▒▒ ▒▒▒▒ ▒ ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒ | ||
▓ ▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ | ||
█ █ ███████ ███ ██ ████ ██ ██ █████ ████ ███ ██ ███████ ███████ ████ ████ | ||
█ ████ █ ███████ ████ ██ ██ ████ ████ ████ ████ █ █ █ ████ ████ ████ | ||
By undeƒined | ||
------------ | ||
Main parser example, other parsers can inherit from this class | ||
""" | ||
from queue import Queue | ||
|
||
from .parser import MainScraper | ||
|
||
|
||
class ParserTheSpeedSock5Proxy(MainScraper): | ||
def __init__(self) -> None: | ||
MainScraper.__init__(self) | ||
self.zone = None | ||
|
||
@classmethod | ||
async def format_url(cls, url, *args, **kwargs) -> str: | ||
"""Formats URL before scraping, let us adjust query parameters for each parser""" | ||
cls.zone = kwargs.get("country", "us") | ||
return url | ||
|
||
@classmethod | ||
async def format_raw(cls, html: str) -> list: | ||
"""Parse text/html pages, customized method for the parser of this website""" | ||
result = [] | ||
data = html.split('\n') | ||
for proxy in data: | ||
if proxy: | ||
protocol = 'http' | ||
ip = proxy.split(':')[0] | ||
port = proxy.split(':')[-1] | ||
result.append({ | ||
'zone': cls.zone.upper(), | ||
'method': protocol, | ||
'anonymity': 'unknown', | ||
'protocol': protocol, | ||
'port': port, | ||
'ip': ip | ||
}) | ||
return result | ||
|
||
@classmethod | ||
async def format_data(cls, zone: str, data: dict, queue: Queue) -> None: | ||
"""Data formatter, formats data and returns is back in the process Queue""" | ||
queue.put(data) | ||
return queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.