-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwikitcat.py
More file actions
47 lines (36 loc) · 1.28 KB
/
wikitcat.py
File metadata and controls
47 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
#Autor: Antoine "0x010C" Lamielle
#Date: 20 February 2016
#License: GNU GPL v3
import sys
import time
import json
import requests
import pywiki
#Paramètres
version = "1.02"
src_lang = "en"
dst_lang = "fr"
searched_template = "Template:ja-noun"
editintro_template = "Utilisateur:Thibaut120094/template_ja"
# Main
def main():
pw_src = pywiki.Pywiki(src_lang+"wikit-NeoBOT")
pw_dst = pywiki.Pywiki(dst_lang+"wikit-NeoBOT")
pw_src.login()
pw_dst.login()
ti_continue = ""
all_titles = []
i = 0
while ti_continue != None:
(titles, ti_continue) = pw_src.get_transcluded_pages(searched_template, 0, ti_continue)
i += pw_src.limit
print i
all_titles += pw_dst.exist(titles, invert=True)
text = "This is a bot-generated list. Contact [[User:0x010C]] for more details.\n\n"
text += "'''"+str(len(all_titles))+" pages''' transcluing [[:"+src_lang+":"+searched_template+"]] on "+src_lang+".wikit doesn't exist here.\n\n"
for title in all_titles:
text += "* [[:"+src_lang+":"+title+"|"+title+u"]] → [["+title+"]] <small>[https://"+dst_lang+".wiktionary.org/w/index.php?action=edit&editintro="+editintro_template+"&title="+title+u" (créer)]</small>\n"
pw_dst.replace("User:NeoBot/list/"+searched_template, text, "Bot : Update list")
main()