2017-08-05 93 views

回答

0

對於許多特殊的網頁,包括LongPages,該API相當於是querypage模塊:

let query = { 
 
    action: 'query', 
 
    list: 'querypage', 
 
    qppage: 'Longpages', 
 
    format: 'json', 
 
    formatversion: 2, 
 
    origin: '*' 
 
}; 
 
function doQuery(query) { 
 
    return $.get('https://en.wikipedia.org/w/api.php', query).then(function (data) { 
 
    console.log(data.query.querypage.results.map(function (item) { 
 
     return item.title; 
 
    })); 
 
    if (data.continue) { 
 
     let continueQuery = $.extend({}, query, data.continue); 
 
     return doQuery(continueQuery); 
 
    } 
 
    }); 
 
} 
 
doQuery(query);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

+0

您可以添加https://en.wikipedia.org/w/api.php?action=query&list=querypage&qppage=Longpages&format=json作爲例子嗎? –

相關問題