Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Jubugon
.
Toggle Highlighting
SQL
mediawikiURL = "https://en.wikipedia.org/w/api.php" pages = ["rt.com","*.bbc.co.uk", "wikileaks.org"] now = datetime.datetime.now() for link in pages: simpledic = {} titles = [] parameters = { 'action': 'query', 'format': 'json', 'continue': '', 'list': 'exturlusage', 'euprotocol': 'http', #How can I get both http and https? 'euquery': link, 'eunamespace': '*', 'eulimit': 'max'} for x in page["query"]["exturlusage"]: title = x["title"] titles.append(title) pageid = x["pageid"] simpledic[title] = pageid #Create a simple dictionary with title : id wp_call = requests.get(mediawikiURL, params=parameters) page = wp_call.json() #converts into a dictionary parameters2 = { 'action': 'query', 'format': 'json', 'continue': '', 'list': 'exturlusage', 'euprotocol': 'https', #How can I get both http and https? 'euquery': link, 'eunamespace': '*', 'eulimit': 'max'} wp_call2 = requests.get(mediawikiURL, params=parameters2) page2 = wp_call.json() #converts into a dictionary #pprint.pprint(page) for x in page2["query"]["exturlusage"]: title = x["title"] titles.append(title) pageid = x["pageid"] simpledic[title] = pageid #Create a simple dictionary with title : id print(link, len(simpledic.keys()))
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...