Closed hugolpz closed 2 years ago
Given core script.js :
const Wikiapi= require('wikiapi'); (async () => { var targetwiki = new Wikiapi('commons'); try { // await targetwiki.download(targetwiki.to_namespace('Lingua_Libre_pronunciation-cmn', 'Category'), { directory: './downloads',max_threads: 4 }); await targetwiki.download( 'Lingua_Libre_pronunciation-cmn', { directory: './', max_threads: 4, page_filter(page_data) { console.log('@Yug: ',JSON.stringify(page_data)) return true; } }); } catch (error) { console.log(`Download error : ${JSON.stringify(error)}`) } })();
It failed to download, and simply returned :
yug@yug-k401ub:~/Documents/WikiapiJS-Eggs$ node ./wiki-download-many-category_tree_and_files.js get_API_parameters: Cache commonswiki: path=query+siteinfo get_API_parameters: Cache commonswiki: path=query+imageinfo
(Also, I don't understand the role of page_filter() so i neutralised it)
page_filter()
Actual solution, add Category: to the Category's name :
Category:
await targetwiki.download("Category:Lingua_Libre_pronunciation-cmn", { /* same options here */ } );
Also, allow me to facepalm myself.
Given core script.js :
It failed to download, and simply returned :
(Also, I don't understand the role of
page_filter()
so i neutralised it)