diff --git a/.gitignore b/.gitignore index 50da241..48bc35c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.swp *.db __pycache__ +.idea \ No newline at end of file diff --git a/README.md b/README.md index 472c8d5..b4f1105 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +## Important update!!! http://proxylist.hidemyass.com no londer available so use simple gist below for now +https://gist.github.com/aorzh/7c37bf7da5dc062901a4f06bc9fecd5d + + # HideMyPython! _ _ _ _ __ __ _____ _ _ _ | | | (_) | | | \/ | | __ \ | | | | | | @@ -41,6 +45,10 @@ the following command: where `output_file` is the database file where the proxies will be stored. +If you need save to text file use: + + ./hide_my_python.py -t + Don't forget to make the script executable with: chmod +x hide_my_python.py diff --git a/arguments.py b/arguments.py index 0140890..9ca1909 100644 --- a/arguments.py +++ b/arguments.py @@ -27,177 +27,183 @@ import argparse from os import path + def create_argument_parser(): - arg_parser = argparse.ArgumentParser( - prog='hide_my_python', - description='A parser to retrieve proxies from HideMyAss!', - epilog='Go to https://hidemyass.com/proxy-list/ to see the ' - 'different available options.') - - # The user has to specify an output file - arg_parser.add_argument('-o', dest='database_file', type=str, - required=True, - help='database file where the proxies will be saved') - - # The user can specify a maximum number of proxies to retrieve - arg_parser.add_argument('-n', dest='number_of_proxies', type=int, - default=0, - help='maximum number of proxies to retrieve (default: all)') - - # The user can specify a list of countries - arg_parser.add_argument('-ct', - default=path.join(path.dirname(sys.argv[0]), 'countries_all'), - dest='countries_file', type=argparse.FileType('r'), - help='file containing the countries where the ' - 'proxies can be based (default: %(default)s)') - - # The user can specify a list of ports - arg_parser.add_argument('-p', type=int, nargs='+', dest='ports', - help='list of ports (max: 20 ports) the proxies listen on ' - '(default: every port)') - - # The user can specify a list of protocols - arg_parser.add_argument('-pr', type=str, nargs='+', - choices=['http', 'https', 'socks'], dest='protocols', - help='protocols used by the proxies ' - '(default: HTTP, HTTPS and SOCKS4/5)') - - # The user can specify the anonymity level - arg_parser.add_argument('-a', default=0, action='count', dest='anonymity', - help='flag used to determine the proxies minimum anonymity ' - 'level, e.g. -a sets the minimum anonymity level to Low, ' - '-aa to Medium, -aaa to High, etc. (default minimum level: ' - 'None)') - - arg_parser.add_argument('-ka', action='store_true', - dest='keep_alive', - help='flag used to determine if proxies with the Keep Alive ' - 'option should be returned, as they are likely honey pots ' - '(default: no)') - - # The user can specify the required speed - arg_parser.add_argument('-s', default=1, action='count', dest='speed', - help='flag used to determine the proxies minimum speed ' - 'level, e.g. -s sets the minimum speed level to Medium, ' - '-ss to Fast (default minimum level: Slow)') - - # The user can specify the connection time - arg_parser.add_argument('-c', default=1, action='count', - dest='connection_time', - help='flag used to determine the proxies minimum connection time ' - 'level, e.g. -c sets the minimum connection time level to ' - 'Medium, -cc to Fast (default minimum level: Slow)') - - arg_parser.add_argument('-v', action='store_true', dest='verbose', - help='explain what is being done') - - return arg_parser + arg_parser = argparse.ArgumentParser( + prog='hide_my_python', + description='A parser to retrieve proxies from HideMyAss!', + epilog='Go to https://hidemyass.com/proxy-list/ to see the ' + 'different available options.') + + # The user has to specify an output file + arg_parser.add_argument('-o', dest='database_file', type=str, + required=False, + help='database file where the proxies will be saved') + + # + arg_parser.add_argument('-t', dest='text_file', type=str, + required=False, + help='text file when proxies will be saved') + + # The user can specify a maximum number of proxies to retrieve + arg_parser.add_argument('-n', dest='number_of_proxies', type=int, + default=0, + help='maximum number of proxies to retrieve (default: all)') + + # The user can specify a list of countries + arg_parser.add_argument('-ct', + default=path.join(path.dirname(sys.argv[0]), 'countries_all'), + dest='countries_file', type=argparse.FileType('r'), + help='file containing the countries where the ' + 'proxies can be based (default: %(default)s)') + + # The user can specify a list of ports + arg_parser.add_argument('-p', type=int, nargs='+', dest='ports', + help='list of ports (max: 20 ports) the proxies listen on ' + '(default: every port)') + + # The user can specify a list of protocols + arg_parser.add_argument('-pr', type=str, nargs='+', + choices=['http', 'https', 'socks'], dest='protocols', + help='protocols used by the proxies ' + '(default: HTTP, HTTPS and SOCKS4/5)') + + # The user can specify the anonymity level + arg_parser.add_argument('-a', default=0, action='count', dest='anonymity', + help='flag used to determine the proxies minimum anonymity ' + 'level, e.g. -a sets the minimum anonymity level to Low, ' + '-aa to Medium, -aaa to High, etc. (default minimum level: ' + 'None)') + + arg_parser.add_argument('-ka', action='store_true', + dest='keep_alive', + help='flag used to determine if proxies with the Keep Alive ' + 'option should be returned, as they are likely honey pots ' + '(default: no)') + + # The user can specify the required speed + arg_parser.add_argument('-s', default=1, action='count', dest='speed', + help='flag used to determine the proxies minimum speed ' + 'level, e.g. -s sets the minimum speed level to Medium, ' + '-ss to Fast (default minimum level: Slow)') + + # The user can specify the connection time + arg_parser.add_argument('-c', default=1, action='count', + dest='connection_time', + help='flag used to determine the proxies minimum connection time ' + 'level, e.g. -c sets the minimum connection time level to ' + 'Medium, -cc to Fast (default minimum level: Slow)') + + arg_parser.add_argument('-v', action='store_true', dest='verbose', + help='explain what is being done') + + return arg_parser + def process_arguments(args, arg_parser): + # If the given number of proxies is negative, + # we return an error + if args.number_of_proxies < 0: + error_msg = 'argument {0}: invalid value ' \ + + '(a positive integer is required): {1}' + error_msg = error_msg.format('-n', args.number_of_proxies) + arg_parser.error(error_msg) + + # We retrieve the countries from the given file + args.countries_list = [] + for country in args.countries_file.readlines(): + country = country.rstrip() + args.countries_list.append(country) + + # If ports were specified + if args.ports: + # We delete the duplicates + args.ports = list(set(args.ports)) + # If too many ports were specified, we exit with an error + if len(args.ports) > 20: + error_msg = 'argument {0}: invalid value ' \ + + '(maximum 20 ports): {1} ports given' + error_msg = error_msg.format('-p', len(args.ports)) + arg_parser.error(error_msg) + # Otherwise, we create a comma-separated string + else: + ports_string = '' + for port in args.ports: + # If the port is in the good range, we add it + if 1 <= port and port <= 65535: + ports_string += '{0}, '.format(port) + # Otherwise, we raise an error + else: + error_msg = 'argument {0}: invalid value ' \ + + '(port must be between 1 and 65535): {1}' + error_msg = error_msg.format('-p', port) + arg_parser.error(error_msg) + # We delete the last comma + ports_string = ports_string[:-2] + args.ports = ports_string + # If no ports were specified, we do nothing + else: + args.ports = '' + + # If no protocol was specified, we consider every possible protocol + if not args.protocols: + args.protocols = ['http', 'https', 'socks'] + # Otherwise, we delete the duplicates + else: + args.protocols = list(set(args.protocols)) + + # The maximum anonymity level is 4 + if args.anonymity > 4: + args.anonymity = 4 + + # The maximum speed level is 3 + if args.speed > 3: + args.speed = 3 + + # The maximum connection time level is 3 + if args.connection_time > 3: + args.connection_time = 3 - # If the given number of proxies is negative, - # we return an error - if args.number_of_proxies < 0: - error_msg = 'argument {0}: invalid value '\ - + '(a positive integer is required): {1}' - error_msg = error_msg.format('-n', args.number_of_proxies) - arg_parser.error(error_msg) - - # We retrieve the countries from the given file - args.countries_list = [] - for country in args.countries_file.readlines(): - country = country.rstrip() - args.countries_list.append(country) - - # If ports were specified - if args.ports: - # We delete the duplicates - args.ports = list(set(args.ports)) - # If too many ports were specified, we exit with an error - if len(args.ports) > 20: - error_msg = 'argument {0}: invalid value '\ - + '(maximum 20 ports): {1} ports given' - error_msg = error_msg .format('-p', len(args.ports)) - arg_parser.error(error_msg) - # Otherwise, we create a comma-separated string - else: - ports_string = '' - for port in args.ports: - # If the port is in the good range, we add it - if 1 <= port and port <= 65535: - ports_string += '{0}, '.format(port) - # Otherwise, we raise an error - else: - error_msg = 'argument {0}: invalid value '\ - + '(port must be between 1 and 65535): {1}' - error_msg = error_msg .format('-p', port) - arg_parser.error(error_msg) - # We delete the last comma - ports_string = ports_string[:-2] - args.ports = ports_string - # If no ports were specified, we do nothing - else: - args.ports = '' - - # If no protocol was specified, we consider every possible protocol - if not args.protocols: - args.protocols = ['http', 'https', 'socks'] - # Otherwise, we delete the duplicates - else: - args.protocols = list(set(args.protocols)) - - # The maximum anonymity level is 4 - if args.anonymity > 4: - args.anonymity = 4 - - # The maximum speed level is 3 - if args.speed > 3: - args.speed = 3 - - # The maximum connection time level is 3 - if args.connection_time > 3: - args.connection_time = 3 def print_arguments(args): - # We display the number of proxies - if args.number_of_proxies > 0: - number = args.number_of_proxies - else: - number = 'all' - print('[info] number of proxies: {0}'.format(number)) - - # We display the first five countries - if len(args.countries_list) <= 5: - countries = args.countries_list - else: - countries = '{0} and {1} more' - countries = countries.format(args.countries_list[0:5], - len(args.countries_list) - 5) - print('[info] countries: {0}'.format(countries)) - - # We display the ports - if args.ports: - ports = args.ports - else: - ports = 'all' - print('[info] ports: {0}'.format(ports)) - - # We display the protocols - print('[info] protocols: {0}'.format(args.protocols)) - - # We display the anonymity levels - anonymity_levels = ['None', 'Low', 'Medium', 'High'] - if args.keep_alive: - anonymity_levels.append('High +KA') - print('[info] anonymity: {0}'.format( - anonymity_levels[args.anonymity:])) - - # We display the speed levels - speed_levels = ['Slow', 'Medium', 'High'] - print('[info] speed: {0}'.format(speed_levels[args.speed - 1:])) - - # We display the speed levels - connection_time_levels = ['Slow', 'Medium', 'High'] - print('[info] connection time: {0}'.format( - connection_time_levels[args.connection_time - 1:])) - + # We display the number of proxies + if args.number_of_proxies > 0: + number = args.number_of_proxies + else: + number = 'all' + print('[info] number of proxies: {0}'.format(number)) + + # We display the first five countries + if len(args.countries_list) <= 5: + countries = args.countries_list + else: + countries = '{0} and {1} more' + countries = countries.format(args.countries_list[0:5], + len(args.countries_list) - 5) + print('[info] countries: {0}'.format(countries)) + + # We display the ports + if args.ports: + ports = args.ports + else: + ports = 'all' + print('[info] ports: {0}'.format(ports)) + + # We display the protocols + print('[info] protocols: {0}'.format(args.protocols)) + + # We display the anonymity levels + anonymity_levels = ['None', 'Low', 'Medium', 'High'] + if args.keep_alive: + anonymity_levels.append('High +KA') + print('[info] anonymity: {0}'.format( + anonymity_levels[args.anonymity:])) + + # We display the speed levels + speed_levels = ['Slow', 'Medium', 'High'] + print('[info] speed: {0}'.format(speed_levels[args.speed - 1:])) + + # We display the speed levels + connection_time_levels = ['Slow', 'Medium', 'High'] + print('[info] connection time: {0}'.format( + connection_time_levels[args.connection_time - 1:])) diff --git a/connect.py b/connect.py index 2852b44..812d9de 100644 --- a/connect.py +++ b/connect.py @@ -25,6 +25,7 @@ import requests + def build_post_request(args): post_request = {} @@ -36,7 +37,7 @@ def build_post_request(args): post_request['p'] = args.ports # We build the protocols parameter - protocol_codes = {'http' : 0, 'https' : 1, 'socks' : 2} + protocol_codes = {'http': 0, 'https': 1, 'socks': 2} for i, protocol in enumerate(args.protocols): post_request['pr[{0}]'.format(i)] = protocol_codes[protocol] @@ -46,7 +47,7 @@ def build_post_request(args): for anonymity in range(args.anonymity, max_anonymity_level): index = anonymity - args.anonymity post_request['a[{0}]'.format(index)] = anonymity - + # We build the speed level for speed in range(args.speed, 4): index = speed - args.speed @@ -66,14 +67,14 @@ def build_post_request(args): # We return the request return post_request + def send_data(url, data=None, cookies=None, allow_redirects=True): # If we have data, we POST if data: r = requests.post(url, data=data, cookies=cookies, - allow_redirects=allow_redirects) + allow_redirects=allow_redirects) # Otherwise, we GET else: r = requests.get(url, cookies=cookies, allow_redirects=allow_redirects) return r - diff --git a/database.py b/database.py index 24e0961..71d1ad5 100644 --- a/database.py +++ b/database.py @@ -23,36 +23,36 @@ import sys import sqlite3 + def insert_in_database(cursor, proxy): + # We check if the prxoy is already in the database + cursor.execute('SELECT id FROM proxies WHERE ip=? and port=?', proxy[0:2]) - # We check if the prxoy is already in the database - cursor.execute('SELECT id FROM proxies WHERE ip=? and port=?', proxy[0:2]) + # If it is, we don't store it + if cursor.fetchone(): + return - # If it is, we don't store it - if cursor.fetchone(): - return + # Otherwise, we save it + cursor.execute('INSERT INTO proxies (ip, port, type, country, anonymity, ' + 'speed, connection_time) VALUES (?, ?, ?, ?, ?, ?, ?)', proxy) - # Otherwise, we save it - cursor.execute('INSERT INTO proxies (ip, port, type, country, anonymity, ' - 'speed, connection_time) VALUES (?, ?, ?, ?, ?, ?, ?)', proxy) def initialize_database(database_file): - # We connect to the database file - connection = sqlite3.connect(database_file) - cursor = connection.cursor() - - # We create the table where the proxies will be stored - try: - cursor.execute('CREATE TABLE proxies (id INTEGER PRIMARY KEY ' - 'AUTOINCREMENT, ip TEXT, port INTEGER, type TEXT, country TEXT, ' - 'anonymity TEXT, speed TEXT, connection_time TEXT)') - # If there's already such a table, we don't have anything to do - except sqlite3.OperationalError: - pass - # Otherwise, we save the changes - else: - connection.commit() - - # We return the connection to the database - return connection, cursor - + # We connect to the database file + connection = sqlite3.connect(database_file) + cursor = connection.cursor() + + # We create the table where the proxies will be stored + try: + cursor.execute('CREATE TABLE proxies (id INTEGER PRIMARY KEY ' + 'AUTOINCREMENT, ip TEXT, port INTEGER, type TEXT, country TEXT, ' + 'anonymity TEXT, speed TEXT, connection_time TEXT)') + # If there's already such a table, we don't have anything to do + except sqlite3.OperationalError: + pass + # Otherwise, we save the changes + else: + connection.commit() + + # We return the connection to the database + return connection, cursor diff --git a/hide_my_python.py b/hide_my_python.py index 2bdbf15..e39fed9 100755 --- a/hide_my_python.py +++ b/hide_my_python.py @@ -26,37 +26,48 @@ import parser import database + def main(): - # We create an argument parser - arg_parser = arguments.create_argument_parser() + # We create an argument parser + arg_parser = arguments.create_argument_parser() - # We parse the arguments - args = arg_parser.parse_args(sys.argv[1:]) - arguments.process_arguments(args, arg_parser) + # We parse the arguments + args = arg_parser.parse_args(sys.argv[1:]) + arguments.process_arguments(args, arg_parser) - # If the verbose mode is on, we display the arguments - if args.verbose: - arguments.print_arguments(args) + # If the verbose mode is on, we display the arguments + if args.verbose: + arguments.print_arguments(args) - # We open the database file where the proxies will be stored - connection, cursor = database.initialize_database(args.database_file) + if args.database_file is not None and args.text_file is None: + # We open the database file where the proxies will be stored + connection, cursor = database.initialize_database(args.database_file) - try: - # We generate the proxies - for proxy in parser.generate_proxy(args): - # And we store them in the database - database.insert_in_database(cursor, proxy) - except KeyboardInterrupt: - if args.verbose: - print('') - print('[warn] received interruption signal') + try: + # We generate the proxies + for proxy in parser.generate_proxy(args): + # And we store them in the database + database.insert_in_database(cursor, proxy) + except KeyboardInterrupt: + if args.verbose: + print('') + print('[warn] received interruption signal') - # We save the changes made to the database, and close the file - connection.commit() - connection.close() + # We save the changes made to the database, and close the file + connection.commit() + connection.close() - return 0 + return 0 -if __name__ == '__main__': - main() + # Write to text file with priority + elif args.text_file is not None or args.text_file is not None and args.database_file is not None: + with open(args.text_file, 'w') as tf: + for proxy in parser.generate_proxy(args): + proxy_line = proxy[2].lower() + '://' + str(proxy[0]) + ':' + str(proxy[1]) + '\n' + tf.write(proxy_line) + elif args.database_file is None and args.text_file is None: + return 'Please specify output file!' + +if __name__ == '__main__': + main() diff --git a/list.txt b/list.txt new file mode 100644 index 0000000..c44b22a --- /dev/null +++ b/list.txt @@ -0,0 +1,111 @@ +http:92.42.249.229:6666 +http:190.121.138.162:8080 +http:124.47.6.169:80 +http:87.98.147.195:3128 +http:177.43.72.251:3128 +http:82.114.82.62:8080 +http:123.30.238.16:3128 +http:200.29.191.149:3128 +http:189.202.216.137:80 +http:49.0.2.82:8080 +http:118.97.15.106:8080 +http:190.77.17.151:8080 +http:94.20.21.38:3128 +http:190.38.82.248:8080 +http:111.68.99.57:8080 +http:212.138.92.17:8080 +http:97.77.104.22:3128 +http:97.77.104.22:80 +http:192.25.162.203:80 +http:202.52.12.30:8080 +http:193.84.184.25:8080 +http:61.162.223.41:9797 +http:200.85.37.254:80 +http:218.56.132.158:8080 +http:149.202.34.104:3128 +http:103.247.101.102:8080 +http:5.45.64.97:3128 +http:195.114.128.9:3128 +http:59.44.244.14:9797 +http:190.238.146.176:8080 +http:180.183.153.244:3128 +http:62.122.100.90:8080 +http:213.131.47.194:8080 +http:92.222.109.69:3128 +http:114.4.39.54:8080 +http:113.200.29.10:9999 +http:178.22.148.122:3129 +http:218.56.132.155:8080 +http:177.200.82.236:8080 +http:117.74.121.146:80 +http:110.78.161.106:8080 +http:119.42.80.211:8080 +http:178.215.111.70:9999 +http:58.9.99.41:3128 +http:222.41.113.43:8080 +http:219.150.242.54:9999 +http:92.222.109.73:3128 +http:187.44.1.54:8080 +http:201.208.110.231:8080 +http:94.229.247.57:8080 +http:179.108.32.193:8080 +http:202.162.198.178:8080 +http:218.56.132.154:8080 +http:180.211.179.50:8080 +http:152.26.30.150:8080 +http:202.148.4.26:8080 +http:202.137.25.53:3128 +http:125.160.120.181:8080 +http:63.150.152.151:8080 +http:202.78.206.83:8080 +http:103.28.225.180:8080 +http:190.248.135.134:8080 +http:83.221.208.217:8080 +http:195.175.62.34:8080 +http:119.42.80.226:8080 +http:182.160.102.146:3128 +http:88.225.232.158:8080 +http:82.209.49.200:8080 +http:188.169.123.210:8080 +http:203.201.172.90:3128 +http:201.57.249.10:8080 +http:194.154.74.210:8080 +http:119.29.119.49:80 +http:207.5.112.114:8080 +http:181.111.177.115:8080 +http:27.191.234.69:9999 +http:176.9.65.84:80 +http:61.19.51.51:8080 +http:190.199.134.104:8080 +http:190.79.130.243:8080 +http:186.225.52.57:8080 +http:103.4.165.244:8080 +http:186.91.198.134:8080 +http:190.214.48.125:8080 +http:92.222.107.181:3128 +http:138.201.63.123:31288 +http:212.200.126.14:8080 +http:180.250.182.50:8080 +http:92.222.109.55:3128 +http:186.250.96.66:8080 +http:31.25.141.148:8080 +http:95.170.222.106:8080 +http:63.150.152.151:3128 +http:186.14.164.65:8080 +http:177.69.52.192:3128 +http:94.231.116.134:8080 +http:80.188.135.10:8080 +http:91.217.42.2:8080 +http:187.60.40.113:8080 +http:202.106.16.36:3128 +http:218.29.111.106:9999 +http:123.30.75.115:3128 +http:186.95.14.82:8080 +http:186.95.59.169:8080 +http:182.253.19.90:8080 +http:122.154.71.49:8080 +http:177.55.253.68:8080 +http:184.49.233.234:8080 +http:195.209.107.148:3128 +http:190.73.133.224:8080 +http:190.181.18.232:8080 diff --git a/parser.py b/parser.py index d88ca6b..5d46070 100644 --- a/parser.py +++ b/parser.py @@ -26,8 +26,8 @@ import regex import connect -def parse_ip_port(ip_port_html): +def parse_ip_port(ip_port_html): # We parse the class which won't be displayed display_none_list = regex.DISPLAY_NONE_CLASS.findall(ip_port_html) @@ -50,8 +50,8 @@ def parse_ip_port(ip_port_html): return ip, port -def parse_proxy(proxy_html): +def parse_proxy(proxy_html): # We get the chunk of code corresponding to the IP:port... ip_port_html = regex.IP_PORT_HTML.search(proxy_html).group(0) # ...and we parse it @@ -60,7 +60,7 @@ def parse_proxy(proxy_html): # We get the chunk of code corresponding to the country... country_html = regex.COUNTRY_HTML.search(proxy_html).group(0) # ...and we parse it - country = regex.COUNTRY.search(country_html).group(1) + country = regex.COUNTRY.search(country_html).group(1).strip() # We get the chunk of code corresponding to the speed... speed_html = regex.SPEED_HTML.search(proxy_html).group(1) @@ -75,12 +75,13 @@ def parse_proxy(proxy_html): # We get the chunk of code corresponding to the type and anonymity... match = regex.TYPE_ANONYMITY.search(proxy_html) # ...and we parse it - type = match.group(1) - anonymity = match.group(2) + type = match.group(1).strip() + anonymity = match.group(2).strip() # We return a tuple return ip, int(port), type, country, anonymity, speed, connection_time + def generate_proxy(args): # We build the post request, using the arguments specified by the user post_request = connect.build_post_request(args) @@ -98,12 +99,12 @@ def generate_proxy(args): # When you do a search, HideMyAss! redirects you to a page. # We retrieve the result page's URL r = connect.send_data('http://proxylist.hidemyass.com/', - data=post_request, allow_redirects=False) + data=post_request, allow_redirects=False) url = 'http://proxylist.hidemyass.com{0}'.format(r.headers['Location']) # HideMyAss! checks this cookie to see if you're a legit user # (and we totally are!) - cookies = {'PHPSESSID' : r.cookies['PHPSESSID']} + cookies = {'PHPSESSID': r.cookies['PHPSESSID']} while keep_retrieving: # Even if a page doesn't exist, HideMyAss! doesn't respond @@ -128,7 +129,7 @@ def generate_proxy(args): # If a maximum number of proxies was set and we # are above this limit, we stop retrieving proxies if (not retrieve_all and - number_of_proxies > args.number_of_proxies): + number_of_proxies > args.number_of_proxies): keep_retrieving = False break # Otherwise, we generate a proxy @@ -148,4 +149,3 @@ def generate_proxy(args): # we stop retrieving proxies if not results_on_page: keep_retrieving = False - diff --git a/regex.py b/regex.py index e8eb2bb..9acdecb 100644 --- a/regex.py +++ b/regex.py @@ -27,8 +27,8 @@ PROXY_HTML = re.compile(r'.*?', - re.DOTALL) +COUNTRY_HTML = re.compile(r'class="country".*?\/>.*?', + re.DOTALL) # This regex is used to recover the country COUNTRY = re.compile(r'([a-zA-Z, ]*)') @@ -57,18 +57,17 @@ # This regex is used to recover the HTML code containing the speed in the # proxy HTML code SPEED_HTML = re.compile(r'
(.*?)
', - flags=re.DOTALL) + flags=re.DOTALL) # This regex is used to recover the speed SPEED = re.compile(r'style="width: (\d+)%') # This regex is used to recover the HTML code containing the connection time in # the proxy HTML code CONNECT_TIME_HTML = re.compile(r'
(.*?)
', - flags=re.DOTALL) + flags=re.DOTALL) # This regex is used to recover the connection time CONNECT_TIME = re.compile(r'style="width: (\d+)%') # This regex is used to recover the type and anonymity level in the proxy # HTML code -TYPE_ANONYMITY = re.compile(r'(.*?)\s*(.*)') - +TYPE_ANONYMITY = re.compile(r'\s*(.*)\s*\s*\s*(.*)\s*')