(self, document: PyQuery)
| 14 | ] |
| 15 | |
| 16 | def parse(self, document: PyQuery) -> [ProxyIP]: |
| 17 | ip_list: [ProxyIP] = [] |
| 18 | |
| 19 | raw_html = document.html() |
| 20 | |
| 21 | ip_port_str_list = re.findall(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{2,5}', raw_html) |
| 22 | |
| 23 | for ip_port in ip_port_str_list: |
| 24 | |
| 25 | ip = re.search(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', ip_port).group(0) |
| 26 | port = re.search(r':(\d{2,5})', ip_port).group(1) |
| 27 | |
| 28 | if ip and port: |
| 29 | p = ProxyIP(ip=ip, port=port) |
| 30 | ip_list.append(p) |
| 31 | |
| 32 | return ip_list |
| 33 | |
| 34 | @staticmethod |
| 35 | def should_render_js() -> bool: |
no test coverage detected