Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

API:Exturlusage/it

From mediawiki.org
This page is atranslated version of the pageAPI:Exturlusage and the translation is 48% complete.
Languages:
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.

Documentazione API

The following documentation is the output ofSpecial:ApiHelp/query+exturlusage, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org).

list=exturlusage (eu)

(main |query |exturlusage)
  • This module requires read rights.
  • This module can be used as a generator.
  • Source:MediaWiki
  • License:GPL-2.0-or-later

Enumerate pages that contain a given URL.

Specific parameters:
Other general parameters are available.
euprop

Which pieces of information to include:

ids
Adds the ID of page.
title
Adds the title and namespace ID of the page.
url
Adds the URL used in the page.
Values (separate with| oralternative): ids, title, url
Default: ids|title|url
eucontinue

When more results are available, use this to continue. More detailed information on how to continue queriescan be found on mediawiki.org.

euprotocol

Protocol of the URL. If empty andeuquery is set, the protocol ishttp andhttps. Leave both this andeuquery empty to list all external links.

One of the following values: Can be empty, or bitcoin, ftp, ftps, geo, git, gopher, http, https, irc, ircs, magnet, mailto, matrix, mms, news, nntp, redis, sftp, sip, sips, sms, ssh, svn, tel, telnet, urn, wikipedia, worldwind, xmpp
Default:(empty)
euquery

Search string without protocol. SeeSpecial:LinkSearch. Leave empty to list all external links.

eunamespace

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.

Values (separate with| oralternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 1728, 1729, 2600, 5500, 5501
To specify all values, use*.
eulimit

How many pages to return.

Type: integer ormax
The value must be between 1 and 500.
Default: 10
euexpandurl
Deprecated.

Expand protocol-relative URLs with the canonical protocol.

Type: boolean (details)

Esempio

GET request

Get a list of pages linking to slashdot.org

api.php?action=query&format=json&list=exturlusage&euquery=slashdot.org [prova in ApiSandbox]

Response

{"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/"}...]}}

Esempio di codice

Python

#!/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

<?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");}

JavaScript

/*    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);});

MediaWiki JS

/*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.');}});

Possibili errori

CodiceInformazione
unknown_euprotocolWrong property for protocol parameter (use value from the list of supported protocols)
badcontinueInvalid continue param. You should pass the original value returned by the previous query.

Parameter history

  • v1.21:Introducedeuexpandurl

Vedi anche

  • API:Backlinks – elenca i collegamenti a una determinata pagina.
  • API:Links – recupera i collegamenti su una o più determinate pagine.
  • API:IwlinksFind interwiki links on a given page (i.e, meta pages, special pages).
  • API:Extlinks – Trova tutti i collegamenti esterni su una determinata pagina.
  • API:LanglinksGet a list of language links from the given page.Language links represent translations.
  • API:LangbacklinksGet a list of pages that contains a given language link.
Retrieved from "https://www.mediawiki.org/w/index.php?title=API:Exturlusage/it&oldid=7974794"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp