Skip to content

A script based on pywikibot, used for translate and move wikipedia entry to your own wiki.

License

Notifications You must be signed in to change notification settings

swarma/wiki_tm_script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

wiki_tm_script

A script based on pywikibot, used for translate and move wikipedia entry to your own wiki.

Usage

Get pywikibot and script, then moved script in pywikibot

cd ~
git clone https://github.com/wikimedia/pywikibot.git
git clone https://github.com/swarma/wiki_tm_script.git
cp wiki_tm_script/source/wiki_text_cleaner.py pywikibot/pywikibot/wiki_text_cleaner.py
cp wiki_tm_script/source/transfer_translate_bot.py pywikibot/scripts

Config pywikibot

# config wiki site address 
python pwb.py generate_family_file.py
# Follow the prompts to enter the robot account information
python pwb.py generate_user_files.py

Running Example (when you config target wiki site as swarma):

touch items.txt
touch zh_items.txt
python pwb.py transfer_translate_bot -family:wikipedia -lang:en -tofamily:swarma -tolang:zh-cn -file:items.txt

The number of rows of items.txt and zh_items.txt should be the same, each line is entry name of different language.

Note

  1. When your wiki is old version, there will be some problems, then using the patch file
cp -f source/__init__.py pywikibot/pywikibot/site
wiki_tm_script/source/__init__.py pywikibot/pywikibot/
  1. I use caiyun translator and the token in wiki_text_cleaner.py is official demo token, request your own token for test.

Todolist

  • Better zh_items.txt
  • Add test
  • Tackle more wiki Grammar problems

About

A script based on pywikibot, used for translate and move wikipedia entry to your own wiki.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages