| Questa pagina fa parte della documentazioneMediaWiki API. |
| Azione MediaWiki API |
|---|
| Nozioni di base |
| Autenticazione |
| Account e utenti |
| Pagina Operazioni |
|
| Cerca |
| Utilità per gli sviluppatori |
| Tutorial |
| v · d · e |
| Versione MediaWiki: | ≥ 1.11 |
GET request to list pages that link to a certain URL, likeSpecial:Linksearch.
| The following documentation is the output ofSpecial: |
Enumerate pages that contain a given URL.
Which pieces of information to include:
When more results are available, use this to continue. More detailed information on how to continue queriescan be found on mediawiki.org.
Protocol of the URL. If empty andeuquery is set, the protocol ishttp andhttps. Leave both this andeuquery empty to list all external links.
Search string without protocol. SeeSpecial:LinkSearch. Leave empty to list all external links.
The page namespaces to enumerate.
Note: Due tomiser mode, using this may result in fewer thaneulimit results returned before continuing; in extreme cases, zero results may be returned.
How many pages to return.
Expand protocol-relative URLs with the canonical protocol.
Get a list of pages linking to slashdot.org
{"batchcomplete":"","continue":{"eucontinue":"http://org.slashdot./|169423","continue":"-||"},"query":{"exturlusage":[{"pageid":533948,"ns":2,"title":"User:Peter Ellis","url":"http://slashdot.org"},{"pageid":3274,"ns":2,"title":"User:Alexdb","url":"http://slashdot.org/"},{"pageid":36471,"ns":2,"title":"User:Joao","url":"http://slashdot.org/"}...]}}
#!/usr/bin/python3""" get_exturlusage.py MediaWiki API Demos Demo of `Exturlusage` module: Enumerate pages that contain a given URL. MIT License"""importrequestsS=requests.Session()URL="https://en.wikipedia.org/w/api.php"PARAMS={"action":"query","format":"json","list":"exturlusage","euquery":"slashdot.org"}R=S.get(url=URL,params=PARAMS)DATA=R.json()EXTURLS=DATA["query"]["exturlusage"]forexturlinEXTURLS:print("Page "+exturl["title"]+" has "+exturl["url"]+" url.")
<?php/* get_exturlusage.php MediaWiki API Demos Demo of `Exturlusage` module: Enumerate pages that contain a given URL. MIT License*/$endPoint="https://en.wikipedia.org/w/api.php";$params=["action"=>"query","format"=>"json","list"=>"exturlusage","euquery"=>"slashdot.org"];$url=$endPoint."?".http_build_query($params);$ch=curl_init($url);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);$output=curl_exec($ch);curl_close($ch);$result=json_decode($output,true);foreach($result["query"]["exturlusage"]as$k=>$v){echo("Page ".$v["title"]." has ".$v["url"]." url.\n");}
/* get_exturlusage.js MediaWiki API Demos Demo of `Exturlusage` module: Enumerate pages that contain a given URL. MIT License*/varurl="https://en.wikipedia.org/w/api.php";varparams={action:"query",format:"json",list:"exturlusage",euquery:"slashdot.org"};url=url+"?origin=*";Object.keys(params).forEach(function(key){url+="&"+key+"="+params[key];});fetch(url).then(function(response){returnresponse.json();}).then(function(response){varexturls=response.query.exturlusage;for(varexturlinexturls){console.log("Page "+exturls[exturl].title+" has "+exturls[exturl].url+" url.");}}).catch(function(error){console.log(error);});
/*get_exturlusage.jsMediaWiki API DemosDemo of `Exturlusage` module: Enumerate pages that contain a given URL.MIT License*/varparams={action:'query',format:'json',list:'exturlusage',euquery:'slashdot.org'},api=newmw.Api();api.get(params).done(function(data){varexturls=data.query.exturlusage,exturl;for(exturlinexturls){console.log('Page '+exturls[exturl].title+' has '+exturls[exturl].url+' url.');}});
| Codice | Informazione |
|---|---|
| unknown_euprotocol | Wrong property for protocol parameter (use value from the list of supported protocols) |
| badcontinue | Invalid continue param. You should pass the original value returned by the previous query. |
euexpandurl