API:Exturlusage/ar
![]() | هذه الصفحة جزء من توثيق واجهة برمجة تطبيقات ميدياويكي التي تحمل اسم Action. |
إصدار ميدياويكي: | ≥ 1.11 |
طلب GET يسرد الصفحات التي تصل شبكيًا إلى معرف موارد موحد، مثل Special:Linksearch.
توثيق واجهة برمجة التطبيقات
![]() | أعمال التوثيق التالية هي نتاج صفحة Special: |
list=exturlusage (eu)
- 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.
- 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 | or alternative): ids, title, url
- Default: ids|title|url
- eucontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- euprotocol
Protocol of the URL. If empty and euquery is set, the protocol is http and https. Leave both this and euquery 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, worldwind, xmpp
- Default: (empty)
- euquery
Search string without protocol. See Special:LinkSearch. Leave empty to list all external links.
- eunamespace
The page namespaces to enumerate.
Note: Due to miser mode, using this may result in fewer than eulimit results returned before continuing; in extreme cases, zero results may be returned.
- Values (separate with | or alternative): 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, 2600, 5500, 5501
- To specify all values, use *.
- eulimit
How many pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- euexpandurl
- Deprecated.
Expand protocol-relative URLs with the canonical protocol.
- Type: boolean (details)
مثال
طلب GET
الحصول على قائمة بالصفحات التي تربط شبكيًا بالموقع 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/"
}
...
]
}
}
عينة من الكود البرمجي
Python
#!/usr/bin/python3
"""
get_exturlusage.py
MediaWiki API Demos
Demo of `Exturlusage` module: Enumerate pages that contain a given URL.
MIT License
"""
import requests
S = 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"]
for exturl in EXTURLS:
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
*/
var url = "https://en.wikipedia.org/w/api.php";
var params = {
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){return response.json();})
.then(function(response) {
var exturls = response.query.exturlusage;
for (var exturl in exturls) {
console.log("Page " + exturls[exturl].title + " has " + exturls[exturl].url + " url.");
}
})
.catch(function(error){console.log(error);});
MediaWiki JS
/*
get_exturlusage.js
MediaWiki API Demos
Demo of `Exturlusage` module: Enumerate pages that contain a given URL.
MIT License
*/
var params = {
action: 'query',
format: 'json',
list: 'exturlusage',
euquery: 'slashdot.org'
},
api = new mw.Api();
api.get( params ).done( function ( data ) {
var exturls = data.query.exturlusage,
exturl;
for ( exturl in exturls ) {
console.log( 'Page ' + exturls[ exturl ].title + ' has ' + exturls[ exturl ].url + ' url.' );
}
} );
الأخطاء المحتملة
الكود | معلومات |
---|---|
unknown_euprotocol | Wrong property for protocol parameter (use value from the list of supported protocols) |
badcontinue | متابعة غير صحيحة; يجب عليك تمرير القيمة الأصلية التي تم إرجاعها بواسطة الاستعلام السابق. |
تاريخ المتغيرات
- v1.21: إضافة
euexpandurl
انظر أيضا
- واجهة برمجة التطبيقات:وصلات_عكسية - يسرد قائمة بالوصلات الشبكية إلى صفحة محددة.
- API:Links - يسترد وصلات شبكية خاصة بصفحة محددة أو صفحات معينة.
- API:Iwlinks - البحث عن وصلات شبكية بين مواقع الويكي لصفحة محددة (أي صفحات ميتا والصفحات الخاصة).
- واجهة برمجة التطبيقات:وصلات خارجية - يبحث عن كافة الوصلات الشبكية الخارجية على صفحة محددة.
- API:Langlinks - يحصل على قائمة بوصلات اللغات من صفحة محددة. وصلات اللغات الشبكية هي ترجمات.
- API:Langbacklinks - يحصل على قائمة بالصفحات التي تحتوي على وصلة لغة شبكية محددة.