Hi Amir
the point is there may be an existing data item without language link to fa-wiki and a bot
is able to create a new repository item for fa-wiki without having any language links (or
having it's own link cluster). Before a bot creates a data repository item we must be
be sure that a repository item does not already exists. I am unsure whether this is a job
for bots.
sample:
existing item Q1234 with links en:Hello, fr:Bonjour, es:Hola
your bot find a new page de:Hallo without language links (or with link to nl:Hoi which has
no entry in Q1234 yet).
You are wrongly able to create a new data item for de:Hallo via bot. But you first must
check that the content of de:Hallo does not match any other content of any other data
items's language links (which is in this sample the content of Q1234's language
links). So you must not use this code snippet without having care on this matter.
Regards
xqt
----- Original Nachricht ----
Von: Amir Ladsgroup <ladsgroup(a)gmail.com>
An: Pywikipedia discussion list <pywikipedia-l(a)lists.wikimedia.org>
Datum: 26.02.2013 10:19
Betreff: Re: [Pywikipedia-l] Creating wikidata items
Dear xqt, is it ok?
# -*- coding: utf-8 -*-
import wikipedia
site=wikipedia.getSite('fa',
fam='wikipedia')
listofarticles=[u"???? ???????",u"???? ????"]
for name in listofarticles:
page=wikipedia.Page(site,name)
data=wikipedia.DataPage(page)
try:
items=data.get()
except wikipedia.NoPage:
print "The item doesn't exist. Creating..."
data.createitem("Bot: Importing article from Persian wikipedia")
else:
print "It has been created already. Skipping..."
I tested it, it was ok. but I'm not sure
On Tue, Feb 26, 2013 at 11:49 AM, <info(a)gno.de> wrote:
Hi folks,
Reza1615 as published a small code snippet to create items at data
repository. Please use this sample with care becaus it does not test
whether a data repository item already exists. It only test whether it
exists for a given site page. This could also mean that a given site page
as no language link on a given repository page. This must be checked
before
a page is created.
Regards
xqt
_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
--
Amir
--------------------------------
_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l