All Projects → kanasimi → wikibot

kanasimi / wikibot

Licence: other
Some MediaWiki bot examples including wikipedia, wikidata using MediaWiki module of CeJS library. 採用 CeJS MediaWiki 自動化作業用程式庫來製作 MediaWiki (維基百科/維基數據) 機器人的範例。

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to wikibot

wikiapi
JavaScript MediaWiki API for node.js
Stars: ✭ 28 (+7.69%)
Mutual labels:  wiki, mediawiki, wikipedia, wikidata, wikipedia-bot, cejs
Wikiteam
Tools for downloading and preserving wikis. We archive wikis, from Wikipedia to tiniest wikis. As of 2020, WikiTeam has preserved more than 250,000 wikis.
Stars: ✭ 404 (+1453.85%)
Mutual labels:  wiki, mediawiki, wikipedia
Apps Android Wikipedia
📱The official Wikipedia app for Android!
Stars: ✭ 1,350 (+5092.31%)
Mutual labels:  wiki, mediawiki, wikipedia
SemanticWikibase
Makes Wikibase data available in Semantic MediaWiki
Stars: ✭ 14 (-46.15%)
Mutual labels:  wiki, mediawiki, wikidata
Wikipedia Mirror
🌐 Guide and tools to run a full offline mirror of Wikipedia.org with three different approaches: Nginx caching proxy, Kimix + ZIM dump, and MediaWiki/XOWA + XML dump
Stars: ✭ 160 (+515.38%)
Mutual labels:  wiki, mediawiki, wikipedia
discord-wiki-bot
Wiki-Bot is a bot with the purpose to easily search for and link to wiki pages. Wiki-Bot shows short descriptions and additional info about the pages and is able to resolve redirects and follow interwiki links.
Stars: ✭ 69 (+165.38%)
Mutual labels:  wiki, mediawiki, wikipedia
Linq To Wiki
.Net library to access MediaWiki API
Stars: ✭ 93 (+257.69%)
Mutual labels:  wiki, mediawiki, wikipedia
Wptools
Wikipedia tools (for Humans): easily extract data from Wikipedia, Wikidata, and other MediaWikis
Stars: ✭ 371 (+1326.92%)
Mutual labels:  mediawiki, wikipedia, wikidata
Mediawiki
🌻 The collaborative editing software that runs Wikipedia. Mirror from https://gerrit.wikimedia.org/g/mediawiki/core. See https://mediawiki.org/wiki/Developer_access for contributing.
Stars: ✭ 2,752 (+10484.62%)
Mutual labels:  wiki, mediawiki, wikipedia
Tft Overlay Outdated
TFT Overlay - Team and item builder for League of Legends Teamfight Tactics
Stars: ✭ 44 (+69.23%)
Mutual labels:  wiki, wikipedia
Git Wiki Theme
A revolutionary full-featured wiki for github pages and jekyll. You don't need to compile it!
Stars: ✭ 139 (+434.62%)
Mutual labels:  wiki, wikipedia
Wikit
Wikipedia summaries from the command line
Stars: ✭ 141 (+442.31%)
Mutual labels:  wiki, wikipedia
wikiradio
A radio for Wikimedia Commons audio files
Stars: ✭ 14 (-46.15%)
Mutual labels:  wiki, wikipedia
Gradlewiki
关于Gradle编译你需要知道的一切
Stars: ✭ 174 (+569.23%)
Mutual labels:  wiki, wikipedia
Wiki
Wikipedia Interface for Node.js
Stars: ✭ 180 (+592.31%)
Mutual labels:  wiki, wikipedia
Semanticmediawiki
🔗 Semantic MediaWiki turns MediaWiki into a knowledge management platform with query and export capabilities
Stars: ✭ 359 (+1280.77%)
Mutual labels:  wiki, mediawiki
go-wikidata
Wikidata API bindings in go.
Stars: ✭ 27 (+3.85%)
Mutual labels:  wikipedia, wikidata
equalstreetnames
Map visualizing the streetnames by gender : 50 cities in 11 countries
Stars: ✭ 64 (+146.15%)
Mutual labels:  wikipedia, wikidata
meza
Setup an enterprise MediaWiki server with simple commands
Stars: ✭ 38 (+46.15%)
Mutual labels:  wiki, mediawiki
bitnami-docker-mediawiki
Bitnami Docker Image for MediaWiki
Stars: ✭ 89 (+242.31%)
Mutual labels:  wiki, mediawiki

GitHub commit activity the past week, 4 weeks, year

CeJS MediaWiki bots demo

Some MediaWiki bot examples including wikipedia, wikidata using MediaWiki module of CeJS library and wikiapi. 採用 CeJS MediaWiki 自動化作業用程式庫來製作 MediaWiki (維基百科/維基數據) 機器人的範例。

You might also be interested in wikiapi.

Node.js usage

Installation

  1. Please install node.js and 7-Zip 18.01+.
  2. Creating a working directory and extracting files via executing commands under Windows:
npm i gh-updater
node_modules\.bin\gh-updater kanasimi/wikibot
cd wikibot-master
npm i wikiapi
copy "wiki configuration.sample.js" "wiki configuration.js"

Or under Linux:

npm i gh-updater
node_modules/.bin/gh-updater kanasimi/wikibot
cd wikibot-master
npm i wikiapi
cp "wiki configuration.sample.js" "wiki configuration.js"
  1. Setup wiki configuration.js: Edit wiki configuration.js and fill username / password.

Execution

Let's try it:

$ node
// Load CeJS library.
require('cejs');

// Load modules.
CeL.run([ 'application.net.wiki', 'application.net.wiki.data', 'application.net.wiki.admin' ]);

// Set default language. 改變預設之語言。
CeL.wiki.set_language('en');

// Set up the wiki instance.
var wiki = CeL.wiki.login(user_name, password, 'en');

wiki
// Select page(s) and get the contents of the page(s).
.page('Wikipedia:Sandbox')

// Replace the contents of a page.
.edit('wikitext to replace', {
	nocreate : 1
})

// Add a new section to a normal page or a Flow page.
.edit(': text to add.', {
	section : 'new',
	sectiontitle : 'Sandbox test section',
	summary : 'Sandbox test edit (section)',
	nocreate : 1
})

// Modify the page contents.
.edit(function(page_data) {
	/** {String}page title */
	var title = CeL.wiki.title_of(page_data),
	/** {String}page content, maybe undefined. */
	content = CeL.wiki.content_of(page_data);
	// append a new section
	return content + '\n== New section ==\n: text to add.';
}, {
	summary : 'summary'
});

wiki.categorymembers(category_title, function(page_data_list, error) {
	;
}, {
	limit : 'max'
});

Wikidata example:

// Cache the id of "性質" first. 先快取必要的屬性id值。
CeL.wiki.data.search.use_cache('性質', function(id_list) {
	// Get the id of property '性質' first.
	// and here we get the id of '性質': "P31"
	CeL.log(id_list);
	// 執行剩下的程序. run rest codes.
}, {
	must_callback : true,
	type : 'property'
});

// ----------------------------
// rest codes:

// Set up the wiki instance.
var wiki = CeL.wiki.login(user_name, password, 'zh');

wiki.data('維基數據沙盒2', function(data_JSON) {
	data_JSON.value('性質', {
		// resolve wikibase-item
		resolve_item : true
	}, function(entity) {
		// get "Wikidata Sandbox"
		CeL.log(entity.value('label', 'en'));
	});
});

// Old style. The same effect as codes above.
wiki.data('維基數據沙盒2', function(data_JSON) {
	wiki.data(data_JSON.value('性質'), function(entity) {
		// via wikidata_entity_value()
		// get "维基数据测试沙盒"
		CeL.log(entity.value('label'));
	});
});

// edit properties
wiki.edit_data(function(entity) {
	// add new / set single value with references
	return {
		生物俗名 : '維基數據沙盒2',
		language : 'zh-tw',
		references : {
			臺灣物種名錄物種編號 : 123456,
			// [[d:Special:AbuseFilter/54]]
			// 導入自 : 'zhwikipedia',
			載於 : '臺灣物種名錄物種',
			來源網址 : 'https://www.wikidata.org/',
			檢索日期 : new Date
		}
	};

	// set multiple values
	return {
		labels : {
			ja : 'ウィキデータ・サンドボックス2',
			'zh-tw' : [ '維基數據沙盒2', '維基數據沙盒#2', '維基數據沙盒-2' ]
		},
		descriptions : {
			'zh-tw' : '作為沙盒以供測試功能'
		},
		claims : [ {
			生物俗名 : [ 'SB2#1', 'SB2#2', 'SB2#3' ],
			multi : true,
			language : 'zh-tw',
			references : {
				臺灣物種名錄物種編號 : 123456
			}
		}, {
			読み仮名 : 'かな',
			language : 'ja',
			references : {
				'imported from Wikimedia project' : 'jawikipedia'
			}
		} ]
	};

	// remove specified value 生物俗名=SB2
	return {
		生物俗名 : 'SB2',
		language : 'zh-tw',
		remove : true
	};

	// to remove ALL "生物俗名"
	return {
		生物俗名 : CeL.wiki.edit_data.remove_all,
		language : 'zh-tw'
	};

}, {
	bot : 1,
	summary : 'bot test: edit properties'
});

Screenshot

Screenshot of WPCHECK.js (fix_16 only):

  • Output on console: On console

  • Log page on Wikipedia (ページ上への作業ログ出力): Log page

  • The contributions: Contributions

Features of CeJS MediaWiki module

  • Batch processing.

  • Access and edit wikimedia sister projects + wikidata.

  • Support Flow page: Using the same way adding section to normal page and Flow page.

  • Detection of edit conflicts and {{bots}}.

  • Query list of backlinks, embeddedin, imageusage, linkshere, fileusage, et al.

  • Parse wikitext and modify wikitext inplace.

  • Listen to recent changes with diff function supported.

  • Parse XML file of Wikimedia database backup dumps.

  • Import Wikimedia database backup dumps data to user-created database on Tool Labs. (See process_dump.js)

  • Traversal all 1.5M pages of zhwiki in 12 minutes on Tool Labs. (See traversal_pages.clear.js. It will automatically download xml dump file first.) 12分鐘遍歷所有 zhwiki 頁面。(於 Tool Labs,將自動先下載 xml dump file。)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].