Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P5822
(An Untitled Masterwork)
Active
Public
Actions
Authored by
zhuyifei1999
on Jul 30 2017, 5:01 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F8908886:
Jul 30 2017, 5:01 PM
2017-07-30 17:01:45 (UTC+0)
Subscribers
None
#! /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
()
Event Timeline
zhuyifei1999
created this paste.
Jul 30 2017, 5:01 PM
2017-07-30 17:01:45 (UTC+0)
zhuyifei1999
mentioned this in
T172065: Hunt for Toolforge tools that load resources from third party sites
.
Jul 30 2017, 5:41 PM
2017-07-30 17:41:32 (UTC+0)
Log In to Comment