Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F8908886
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
zhuyifei1999
Jul 30 2017, 5:01 PM
2017-07-30 17:01:45 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import
re
import
subprocess
import
urllib2
import
urlparse
def
main
():
indexurl
=
'https://tools.wmflabs.org/admin/tools'
html
=
urllib2
.
urlopen
(
indexurl
)
.
read
()
for
tool
in
re
.
findall
(
r'<a class="tool-web" href="([^"]+)">'
,
html
):
tool
=
urlparse
.
urljoin
(
indexurl
,
tool
)
process
=
subprocess
.
Popen
([
'slimerjs-0.10.3/slimerjs'
,
'do-tool.js'
,
tool
],
stdin
=
None
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
universal_newlines
=
True
)
while
process
.
poll
()
is
None
:
# for line in process.stdout.readlines():
# http://bugs.python.org/issue3907
while
True
:
line
=
process
.
stdout
.
readline
()
if
not
line
:
break
line
=
line
.
strip
()
parsed
=
urlparse
.
urlparse
(
line
)
if
not
re
.
search
(
r'\.(wikimedia|wmflabs|wikipedia)\.org(:(80|443))?$'
,
parsed
.
netloc
):
print
'
%s
:
%s
'
%
(
tool
,
line
)
if
__name__
==
'__main__'
:
main
()
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4808419
Default Alt Text
(1 KB)
Attached To
Mode
P5822 (An Untitled Masterwork)
Attached
Detach File
Event Timeline
Log In to Comment