equal
deleted
inserted
replaced
56 if not line.startswith('#') |
56 if not line.startswith('#') |
57 ] |
57 ] |
58 |
58 |
59 url = re.sub('^.*://', '', url).split('/')[0].lower() |
59 url = re.sub('^.*://', '', url).split('/')[0].lower() |
60 domain = [] |
60 domain = [] |
61 for section in url.split('.'): |
61 url_sections = ( |
|
62 section.decode('utf-8').encode('idna') |
|
63 for section in url.split('.') |
|
64 ) |
|
65 |
|
66 for section in url_sections: |
62 if section in suffixes: |
67 if section in suffixes: |
63 domain.append(section) |
68 domain.append(section) |
64 else: |
69 else: |
65 domain = [section] |
70 domain = [section] |
66 return '.'.join(domain) |
71 return '.'.join(domain).decode('idna').encode('utf-8') |
67 |
72 |
68 |
73 |
69 if __name__ == '__main__': |
74 if __name__ == '__main__': |
70 try: |
75 try: |
71 url = sys.argv[1] |
76 url = sys.argv[1] |