Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P10689
random-page-title.py
Active
Public
Actions
Authored by
Xiplus
on Mar 12 2020, 12:34 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F31677873: raw.txt
Mar 12 2020, 12:34 PM
2020-03-12 12:34:43 (UTC+0)
Subscribers
None
import
re
import
requests
S
=
requests
.
Session
()
URL
=
'https://zh.wikivoyage.org/w/api.php'
PARAMS
=
{
'action'
:
'purge'
,
'titles'
:
'Wikivoyage:互助客栈'
,
'format'
:
'json'
}
cnt
=
0
while
True
:
cnt
+=
1
# Get page title
req
=
requests
.
get
(
'https://zh.wikivoyage.org/zh-tw/Wikivoyage:互助客栈'
)
html
=
req
.
text
m
=
re
.
search
(
r'<title>(.+?)</title>'
,
html
)
if
m
:
print
(
cnt
,
m
.
group
(
1
))
# Purge page
R
=
S
.
post
(
url
=
URL
,
params
=
PARAMS
)
Event Timeline
Xiplus
created this paste.
Mar 12 2020, 12:34 PM
2020-03-12 12:34:43 (UTC+0)
Xiplus
mentioned this in
T247493: Incorrect namespace displayed in ns4 page title on Chinese Wikiquote and Wikivoyage
.
Log In to Comment