-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_mincss
executable file
·43 lines (36 loc) · 887 Bytes
/
run_mincss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
from mincss.processor import Processor
import sys
import urlparse
def run(url):
p = Processor()
p.process(url)
print "INLINES ".ljust(79, '-')
for each in p.inlines:
print ("On line %s" % each.line)
print '- ' * 40
print "BEFORE"
print each.before
print '- ' * 40
print "AFTER:"
print each.after
print
print
print "LINKS ".ljust(79, '-')
for each in p.links:
print ("On href %s" % each.href)
print '- ' * 40
print "BEFORE"
print each.before
print '- ' * 40
print "AFTER:"
print each.after
print
print
if __name__ == '__main__':
url = sys.argv[1]
parts = urlparse.urlsplit(url)
if not parts.scheme or not parts.netloc:
print "please specify valid url"
else:
run(url)