OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 26 matching lines...) Expand all Loading... |
37 !''' | 37 !''' |
38 | 38 |
39 data = urllib.urlopen('http://mirror3.malwaredomains.com/files/justdomains.z
ip').read() | 39 data = urllib.urlopen('http://mirror3.malwaredomains.com/files/justdomains.z
ip').read() |
40 zip = zipfile.ZipFile(StringIO(data), 'r') | 40 zip = zipfile.ZipFile(StringIO(data), 'r') |
41 info = zip.infolist()[0] | 41 info = zip.infolist()[0] |
42 for line in str(zip.read(info.filename)).splitlines(): | 42 for line in str(zip.read(info.filename)).splitlines(): |
43 domain = line.strip() | 43 domain = line.strip() |
44 if not domain: | 44 if not domain: |
45 continue | 45 continue |
46 | 46 |
47 # HACK: Ignore entry that currently breaks YouTube, see #3521 | |
48 if domain == 's.ytimg.com': | |
49 continue | |
50 | |
51 print >>file, '||%s^' % domain.decode('idna') | 47 print >>file, '||%s^' % domain.decode('idna') |
52 file.close(); | 48 file.close(); |
53 | 49 |
54 if subprocess.check_output(['hg', 'stat', '-R', tempdir]) != '': | 50 if subprocess.check_output(['hg', 'stat', '-R', tempdir]) != '': |
55 subprocess.check_call(['hg', '-q', 'commit', '-R', tempdir, '-A', '-u', 'h
gbot', '-m', 'Updated malwaredomains.com data']) | 51 subprocess.check_call(['hg', '-q', 'commit', '-R', tempdir, '-A', '-u', 'h
gbot', '-m', 'Updated malwaredomains.com data']) |
56 subprocess.check_call(['hg', '-q', 'push', '-R', tempdir]) | 52 subprocess.check_call(['hg', '-q', 'push', '-R', tempdir]) |
57 finally: | 53 finally: |
58 shutil.rmtree(tempdir, ignore_errors=True) | 54 shutil.rmtree(tempdir, ignore_errors=True) |
OLD | NEW |