Lankide:EUmineralbot/kodea1
Appearance
# -*- coding: utf-8 -*-
# Mindatetik datuak xurgatzen dituen programa mineralen infotaulak betetzeko.
#Programak Bartzelonako interes lokaleko zuhaitzen datuak kopiatzeko programaren antzeko
# adaptazio bat da, beraz mezu batzuk eta aldagai batzuk ez dira egokiak
import sys
sys.path.append('/home/jipsagak/Dokumentuak/HP_mineralbot_wiki/core')
import pywikibot
import string
from pywikibot.compat import catlib
import urllib,urllib2
import re
# Metodo honek unicodera bihurtzen du unicodera ezin dituen hitzak saltatuz.
def uniahitza(text):
lerroak=re.split(u" ",text)
testuberria=u""
for lerroa in lerroak:
try:
lerroaberria=unicode(lerroa,"utf-8")
except UnicodeDecodeError:
#print(u"errorea hitzan:",lerroa)
lerroaberria=u"<!-- ERROREA UNICODE BIHURKETAN -->"
testuberria=testuberria+lerroaberria+u" "
return testuberria
# Metodo honek unicodera bihurketa egiten du, ezin dituen lerroak saltatuz.
def unialerroa(text):
lerroak=re.split(u"\n",text)
testuberria=u""
for lerroa in lerroak:
try:
lerroaberria=unicode(lerroa,"utf-8")
except UnicodeDecodeError:
#print(u"error a la línia:",lerroa)
lerroaberria=uniahitza(lerroa)
testuberria=testuberria+lerroaberria+u"\n"
return testuberria
# Webetik datuak irakurtzeko partea hasi egiten du.
# Pasatzen zaion mineral url-tik datuak jasoz, mineralaren txantiloia sortzen du euskeraz.
def irakurriminerala(url):
url='http://www.mindat.org/'+url
try:
pagminerala=urllib.urlopen(url)
except IOError:
print("Errorea IO irekitzerakoan",url)
return ""
textminerala=pagminerala.read()
if re.search("<h1 class='mineralheading'>.*</h1>",textminerala):
nom=re.findall("<h1 class='mineralheading'>(.*)</h1>",textminerala)[0].strip()
else:
nom=""
#Izena ingeleratik euskarara itzultzen du.
nomcat = nom
print nomcat
t = nomcat[-4:]
if t == 'aite' or t == 'eite' or t == 'iite' or t == 'oite' or t == 'uite':
nomcat = nomcat[0:-3] + 'ita'
if nomcat[-3:] == 'ite':
nomcat = nomcat[0:-3] + 'ita'
if 'Phyllo' in nomcat:
nomcat = 'Filo' + nomcat[6:]
if 'Qua' in nomcat:
nomcat = 'Kua' + nomcat[3:]
if 'C' == nomcat[0:1] and nomcat[1:2]!= 'h':
nomcat = 'K' + nomcat[1:]
if '-(' in nomcat:
nomtros = nomcat.split('-(')
nomtrosprimerapart = nomtros[0]
if nomtrosprimerapart[-3:] == 'ite':
nomcat = nomtrosprimerapart[0:-3] + 'ita-(' + nomtros[1]
t = nomtrosprimerapart[-4:]
if t == 'aite' or t == 'eite' or t == 'iite' or t == 'oite' or t == 'uite':
nomcat = nomtrosprimerapart[0:-3] + 'ita-(' + nomtros[1]
nomcatmini = nomcat[0:1].lower() + nomcat[1:]
#Datuak eskuratzen hasi egiten da.
nickelstrunz = ''
if re.search('<a href="strunz.php">Nickel-Strunz 10th \(pending\) ed\.:</a></div><div class="mindatam2">(..?\...?\...?)<br>',textminerala):
nickelstrunz=re.findall('<a href="strunz.php">Nickel-Strunz 10th \(pending\) ed\.:</a></div><div class="mindatam2">(..?\...?\...?)<br>',textminerala)[0].strip()
kategoria = {'1':'[[elementu natiboak]]', '2':'[[sulfuro mineralak|sulfuro]]', '3':'[[haluro mineralak|haluro]]',
'4':'[[mineral oxidoak|oxido]]', '5':'[[karbonato mineralak|karbonato]]', '6':'[[borato mineralak|borato]]',
'7':'[[sulfato mineralak|sulfato]]', '8':'[[fosfato mineralak|fosfato]]', '9':'[[silikato mineralak|silikato]]',
'10':'[[konposatu organiko|substantzia organiko]]'}
Wiki_kat = {'1':'elementu kimikoak', '2':'sufredun mineralak', '3':'Haluroak',
'4':'oxidoak', '5':'karbonatoak', '6':'boratoak',
'7':'sulfatoak', '8':'fosfatoak', '9':'silikatoak',
'10':'konposatu organikoak'}
primer = nickelstrunz.split('.')
kategoriaF = kategoria.get(primer[0],'!!!')
Wiki_kategoriaF = Wiki_kat.get(primer[0],'!!!')
if '|' in kategoriaF:
catA = kategoriaF.split('|')
catB = catA[1].split(']')
catC = catB[0]
kategoriaG = catC
else:
kategoriaG = 'elementu kimiko'
dana = ''
if re.search('<a href="dana.php">Dana 8th ed.:</a></div><div class="mindatam2">..?\..?.\..?.\..?.<br>',textminerala):
dana=re.findall('<a href="dana.php">Dana 8th ed.:</a></div><div class="mindatam2">(..?\..?.\..?.\..?.)<br>',textminerala)[0].strip()
heys = ''
if re.search('<a href="cim.php">Hey\'s CIM Ref.:</a></div><div class="mindatam2">..?\...?\...?<br>',textminerala):
heys=re.findall('<a href="cim.php">Hey\'s CIM Ref.:</a></div><div class="mindatam2">(..?\...?\...?)<br>',textminerala)[0].strip()
aurkikuntza = ''
if re.search('Year of Discovery:</div><div class="mindatam2">....</div>',textminerala):
aurkikuntza=re.findall('Year of Discovery:</div><div class="mindatam2">(....)</div>',textminerala)[0].strip()
motak = ''
if re.search('<a href="/glossary/type_locality">Type Locality:</a></div><div class="mindatam2"><a href="loc-.*?.html">.*?</a>',textminerala):
motak=re.findall('<a href="/glossary/type_locality">Type Locality:</a></div><div class="mindatam2"><a href="loc-.*?.html">(.*?)</a>',textminerala)[0].strip()
distiraF = ''
if re.search('<a href="/glossary/lustre">Lustre:</a></div><div class="mindatam2">.*?</div>',textminerala):
distira=re.findall('<a href="/glossary/lustre">Lustre:</a></div><div class="mindatam2">(.*?)</div>',textminerala)[0].strip().lower()
hiztegia = {'vitreous':'beira', 'earthy':'lurkara', 'dull':'mate', 'waxy':'argizari', 'metallic':'metaliko', 'adamantine':'adamantino', 'pearly':'nakar-itxurako', 'resinous':'erretxinadun', 'sub-adamantine':'subadamantino'}
distirak = distira.split(', ')
for x in distirak:
distiraF = distiraF + hiztegia.get(x,x+'*') + ', '
gardentasunF = ''
if re.search('Diaphaneity \(Transparency\):</div><div class="mindatam2">.*?</div>',textminerala):
gardentasun=re.findall('Diaphaneity \(Transparency\):</div><div class="mindatam2">(.*?)</div>',textminerala)[0].strip().lower()
hiztegia = {'translucent':'zeharrargi', 'transparent':'garden', 'opaque':'opaku'}
gardentasunak = gardentasun.split(', ')
for x in gardentasunak:
gardentasunF = gardentasunF + hiztegia.get(x,'!!!') + ', '
koloreF = ''
if re.search("<span>Colour:<\/span>",textminerala):
kolore=re.findall("<span>Colour:<\/span><div class='twocol'>(.*?)<\/div>",textminerala)[0].strip().lower().rstrip('.')
hiztegia = {'red':'gorria', 'pale red':'gorri argia', 'light red':'gorri argia', 'dark red':'gorri iluna',
'pinky-red':'arrosadun gorria', 'blue':'urdina', 'light blue':'urdin argia', 'pale blue': 'urdin argia',
'dark blue':'urdin iluna', 'greenish-blue':'urdin berdexka', 'navy blue':'itsas urdin', 'cerulean':'zeru-urdin',
'sky blue':'zeru-urdin', 'turquoise blue':'urdin turkesa', 'turquoise':'turkesa', 'blue-green':'urdin-berde',
'teal':'berde urdinxka', 'teal blue':'urdin turkesa', 'cyan':'zian', 'green':'berde', 'light green':'berde argia',
'pale green': 'berde argia', 'dark green':'berde iluna', 'bluish-green':'verde urdinxka', 'lime':'lima',
'green lime':'berde lima', 'chartreuse': 'chartreuse kolorea', 'olive':'oliba', 'olive green':'oliba-berde',
'greenish':'berdexka', 'pinkish to peach-colored':'arrosakara mertxika-kolorea','greenish-black':'beltz berdexka', 'apple-green':'sagar-berde', 'grass green':'belar-berde',
'emerald green':'esmeralda-berde', 'greenish yellow':'hori berdexka', 'pink':'arrosa', 'pale pink':'arros argia',
'light pink':'arros argia', 'dark pink':'arros iluna', 'reddish-pink':'arros gorrixka', 'red pink':'arros gorria',
'gorri bioleta':'gorri moreduna', 'rose':'arrosa', 'magenta':'magenta', 'purple':'purpura',
'bluish-purple':'more urdinxka', 'reddish-purple':'more gorrixka', 'indigo':'anil',
'violet':'bioleta', 'yellow':'hori', 'pale yellow':'laru', 'light yellow':'hori argia', 'dark yellow':'hori iluna',
'orange-yellow':'laranja-horia', 'reddish-yellow':'hori gorrixka', 'greenish-yellow':'hori berdexka',
'bluish-yellow':'hori urdinxka', 'gold':'urrea', 'lemon-yellow':'beilegi',
'pale brass-yellow':'letoi-hori argia', 'brass yellow':'hori letoi', 'brass':'letoi',
'cadmium-yellow':'kadmio-horia', 'cream-yellow':'hori-krema', 'orange':'laranja', 'pale orange':'laranja claro',
'light orange':'laranja argia', 'dark orange':'laranja iluna', 'cream':'krema kolorea', 'white':'zuria',
'yellowish-white':'zuri horixka', 'bluish-white':'zuri urdinxka', 'reddish-white':'zuri gorrixka',
'greenish-white':'zuri berdexka', 'creamy-white':'kremadun zuria', 'ivory':'marfil kolorea', 'snow white':'elur zuria',
'silver':'zilar', 'tin':'eztainu kolorea', 'lead':'berun kolorea', 'black':'beltza', 'bluish-black':'beltz urdinxka',
'greenish-black':'beltz berdexka', 'grey':'grisa', 'pale grey':'gris argia', 'light grey':'gris argia', 'dark grey':'gris iluna',
'yellowish-grey':'gris horixka', 'reddish-grey':'gris gorrixka', 'greenish-grey':'gris berdexka', 'bluish-grey':'gris urdinxka',
'brown':'marroia', 'pale brown':'marroi argia', 'light brown':'marroi argia', 'dark brown':'marroi iluna', 'yellowish-brown':'marroi horixka',
'orange-brown':'laranja-marroia', 'reddish-brown':'marroi gorrixka', 'greenish-brown':'marroi berdexka', 'earthy-brown':'lur kolorea',
'pale':'argia', 'light':'argia', 'dark':'iluna', 'intense':'bizi', 'reddish brown':'marroi gorrixka',
'yellowish gray':'gris horixka', 'smoky-gray':'gris iluna', 'gray-brown':'gris marroia', 'tan':'brontze kolorea',
'golden-yellow':'hori-urrea','colourless':'koloregabe', 'olive-green':'oliba-berde', 'pistachio-green':'berde pistatxo',
'grayish-white':'zuri grixka', 'straw-yellow':'hori lastoa'}
koloreak = kolore.split(', ')
for x in koloreak:
koloreF = koloreF + hiztegia.get(x,x+'*') + ', '
marraF = ''
if re.search('Streak:</div><div class="mindatam2">.*?<',textminerala):
marra=re.findall('Streak:</div><div class="mindatam2">(.*?)<',textminerala)[0].strip().lower()
hiztegia = {'red':'gorria', 'pale red':'gorri argia', 'light red':'gorri argia', 'dark red':'gorri iluna',
'pinky-red':'arrosadun gorria', 'blue':'urdina', 'light blue':'urdin argia', 'pale blue': 'urdin argia',
'dark blue':'urdin iluna', 'greenish-blue':'urdin berdexka', 'navy blue':'itsas urdin', 'cerulean':'zeru-urdin',
'sky blue':'zeru-urdin', 'turquoise blue':'urdin turkesa', 'turquoise':'turkesa', 'blue-green':'urdin-berde',
'teal':'berde urdinxka', 'teal blue':'urdin turkesa', 'cyan':'zian', 'green':'berde', 'light green':'berde argia',
'pale green': 'berde argia', 'dark green':'berde iluna', 'bluish-green':'verde urdinxka', 'lime':'lima',
'green lime':'berde lima', 'chartreuse': 'chartreuse kolorea', 'olive':'oliba', 'olive green':'oliba-berde',
'greenish':'berdexka', 'greenish-black':'beltz berdexka', 'apple-green':'sagar-berde', 'grass green':'belar-berde',
'emerald green':'esmeralda-berde', 'greenish yellow':'hori berdexka', 'pink':'arrosa', 'pale pink':'arros argia',
'light pink':'arros argia', 'dark pink':'arros iluna', 'reddish-pink':'arros gorrixka', 'red pink':'arros gorria',
'gorri bioleta':'gorri moreduna', 'rose':'arrosa', 'magenta':'magenta', 'purple':'purpura',
'bluish-purple':'more urdinxka', 'reddish-purple':'more gorrixka', 'indigo':'anil',
'violet':'bioleta', 'yellow':'hori', 'pale yellow':'laru', 'light yellow':'hori argia', 'dark yellow':'hori iluna',
'orange-yellow':'laranja-horia', 'reddish-yellow':'hori gorrixka', 'greenish-yellow':'hori berdexka',
'bluish-yellow':'hori urdinxka', 'gold':'urrea', 'lemon-yellow':'beilegi',
'pale brass-yellow':'letoi-hori argia', 'brass yellow':'hori letoi', 'brass':'letoi',
'cadmium-yellow':'kadmio-horia', 'cream-yellow':'hori-krema', 'orange':'laranja', 'pale orange':'laranja claro',
'light orange':'laranja argia', 'dark orange':'laranja iluna', 'cream':'krema kolorea', 'white':'zuria',
'yellowish-white':'zuri horixka', 'bluish-white':'zuri urdinxka', 'reddish-white':'zuri gorrixka',
'greenish-white':'zuri berdexka', 'creamy-white':'kremadun zuria', 'ivory':'marfil kolorea', 'snow white':'elur zuria',
'silver':'zilar', 'tin':'eztainu kolorea', 'lead':'berun kolorea', 'black':'beltza', 'bluish-black':'beltz urdinxka',
'greenish-black':'beltz berdexka', 'grey':'grisa', 'pale grey':'gris argia', 'light grey':'gris argia', 'dark grey':'gris iluna',
'yellowish-grey':'gris horixka', 'reddish-grey':'gris gorrixka', 'greenish-grey':'gris berdexka', 'bluish-grey':'gris urdinxka',
'brown':'marroia', 'pale brown':'marroi argia', 'light brown':'marroi argia', 'dark brown':'marroi iluna', 'yellowish-brown':'marroi horixka',
'orange-brown':'laranja-marroia', 'reddish-brown':'marroi gorrixka', 'greenish-brown':'marroi berdexka', 'earthy-brown':'lur kolorea',
'pale':'argia', 'light':'argia', 'dark':'iluna', 'intense':'bizi', 'reddish brown':'marroi gorrixka',
'yellowish gray':'gris horixka', 'smoky-gray':'gris iluna', 'gray-brown':'gris marroia', 'tan':'brontze kolorea',
'golden-yellow':'hori-urrea','colourless':'koloregabe', 'olive-green':'oliba-berde', 'pistachio-green':'berde pistatxo',
'grayish-white':'zuri grixka', 'straw-yellow':'hori lastoa'}
marrak = marra.split(', ')
for x in marrak:
marraF = marraF + hiztegia.get(x,x+'*') + ', '
irmotasunaF = ''
if re.search('Tenacity:</div><div class="mindatam2">.*?<',textminerala):
irmotasuna=re.findall('Tenacity:</div><div class="mindatam2">(.*?)<',textminerala)[0].strip().lower()
hiztegia = {'brittle':'ahula','malleable':'malgua'}
irmotasunak = irmotasuna.split(' ,')
for x in irmotasunak:
irmotasunaF = irmotasunaF + hiztegia.get(x,x+'*') + ', '
esfoliazio = ''
if re.search('Cleavage:</div><div class="mindatam2">.*?</',textminerala):
esfoliazio=re.findall('Cleavage:</div><div class="mindatam2">(.*?)</',textminerala)[0].strip().lower()
esfoliazio = esfoliazio.replace('<br>', ' - ') + '*'
hausketaF = ''
if re.search('Fracture:</div><div class="mindatam2">.*?<',textminerala):
hausketa=re.findall('Fracture:</div><div class="mindatam2">(.*?)<',textminerala)[0].strip().lower()
hiztegia = {'conchoidal':'maskor-itxura', 'irregular':'irregularra', 'uneven':'malkartsu', 'sub-conchoidal':'maskor-itxurapeko',
'hackly':'latz'}
hausketak = re.split(', |/', hausketa)
for x in hausketak:
hausketaF = hausketaF + hiztegia.get(x,x+'*') + ', '
dentsitatea = ''
if re.search('Density:</div><div class="mindatam2">.*?</di',textminerala):
dentsitatea=re.findall('Density:</div><div class="mindatam2">(.*?)</di',textminerala)[0].strip().lower()
dentsitatea = dentsitatea.replace('measured', 'neurtuta').replace('calculated', 'kalkulatuta').replace('.', ',').replace(' ', '; ').replace('-', 'a')
sistema = ''
if re.search('Crystal System:</div><div class="mindatam2">.*?<',textminerala):
sistema=re.findall('Crystal System:</div><div class="mindatam2">(.*?)<',textminerala)[0].strip().lower()
hiztegia = {'tetragonal':'[[Sistema tetragonala|tetragonala]]', 'orthorhombic':'[[Sistema ortoerronbikoa|ortoerronbikoa]]',
'hexagonal':'[[Sistema hexagonala|hexagonala]]', 'triclinic':'[[Sistema triklinikoa|triklinikoa]]',
'monoclinic':'[[Sistema monoklinikoa|monoklinikoa]]', 'isometric':'[[Sistema monoklinikoa|monoklinikoa]]'}
sistema = hiztegia.get(sistema, sistema+'*')
sistA = sistema.split('|')
sistemaLuzea = sistA[0]+']]'
simetria = ''
if re.search('Class \(H-M\):</div><div class="mindatam2">.*?</d',textminerala):
simetria=re.findall('Class \(H-M\):</div><div class="mindatam2">(.*?)</d',textminerala)[0].strip().lower()
hiztegia = {'dipyramidal':'dipiramidala', 'prismatic':'prismatiko', 'dihexagonal dipyramidal':'dihexagonal dipiramidala',
'trapezohedral':'trapezoidala', 'pinacoidal':'pinacoide'}
simetriak = simetria.split(' - ')
simetria = simetriak[0] + ' - ' + hiztegia.get(simetriak[1],simetriak[1]+'*')
simetria = simetria.replace('</i><i>', '').replace('<i>', '\'\'').replace('</i>', '\'\'')
egitura = ''
if re.search('Cell Parameters:</div><div class="mindatam2">.*?</',textminerala):
egitura=re.findall('Cell Parameters:</div><div class="mindatam2">(.*?)</',textminerala)[0].strip().lower()
egitura = egitura.replace(',', ';').replace('.', ',').replace('Å', 'Å').replace('<br>', '; ').replace('α', 'α').replace('°', '°').replace('β', 'β').replace('γ', 'γ')
propoptiques = ''
if re.search('Type:</div><div class="mindatam2">.*?</',textminerala):
propoptiques=re.findall('Type:</div><div class="mindatam2">(.*?)</',textminerala)[0].strip().lower()
propoptiques = propoptiques+'*'
errefrakzio = ''
if re.search('RI values:</div><div class="mindatam2">.*?</d',textminerala):
errefrakzio=re.findall('RI values:</div><div class="mindatam2">(.*?)</d',textminerala)[0].strip().lower()
errefrakzio = errefrakzio.replace('<i>', '\'\'').replace('</i>', '\'\'').replace('.', ',').replace('α', 'α').replace('β', 'β').replace('γ', 'γ').replace('ω', 'ω').replace('ε', 'ε').replace('-', 'a')
birrefringentzia = ''
if re.search('Max Birefringence:</div><div class="mindatam2">.*?<',textminerala):
birrefringentzia=re.findall('Max Birefringence:</div><div class="mindatam2">(.*?)<',textminerala)[0].strip().lower()
birrefringentzia = birrefringentzia.replace('.', ',').replace('δ', 'δ').replace('-', 'a')
formula = ''
if re.search("<div><span>Formula:</span><div class='twocol'>.*?</div></div>",textminerala):
formula=re.findall("<div><span>Formula:</span><div class='twocol'>(.*?)</div></div>",textminerala)[0].strip()
formula = formula.replace(" class='newformsub'", "").replace(" class='newformsup'", "").replace('·','·')
ezpurutasun = ''
if re.search('Common Impurities:</div><div class="mindatam2">.*?<',textminerala):
ezpurutasun=re.findall('Common Impurities:</div><div class="mindatam2">(.*?)<',textminerala)[0].strip()
ezpurutasun = ezpurutasun.replace(',', ', ')
fluoreszentzia = ''
if re.search('<a href="/glossary/fluorescence">Fluorescence in UV light:</a></div><div class="mindatam2">.*?</d',textminerala):
fluoreszentzia=re.findall('<a href="/glossary/fluorescence">Fluorescence in UV light:</a></div><div class="mindatam2">(.*?)</d',textminerala)[0].strip()
fluoreszentzia = fluoreszentzia + '*'
macles = ''
if re.search('Twinning:</div><div class="mindatam2">.*?</d',textminerala):
macles=re.findall('Twinning:</div><div class="mindatam2">(.*?)</d',textminerala)[0].strip().lower()
macles = macles.replace('none observed', 'ez behatuak') + '*'
dureza = ''
if re.search('<div><span>Hardness:</span><div>.*?</div></div>',textminerala):
dureza=re.findall('<div><span>Hardness:</span><div>(.*?)</div></div>',textminerala)[0].strip().lower()
dureza = dureza.replace('½', ',5')
angelua = ''
if re.search('2V:</div><div class="mindatam2">.*?</d',textminerala):
angelua=re.findall('2V:</div><div class="mindatam2">(.*?)</d',textminerala)[0].strip().lower()
angelua = angelua.replace('measured', 'neurri').replace('calculated', 'kalkulu').replace('.', ',').replace(' ,', ',').replace('°', '°')
pleocr = ''
if re.search('Pleochroism:</div><div class="mindatam2">.*?</d',textminerala):
pleocr=re.findall('Pleochroism:</div><div class="mindatam2">(.*?)</d',textminerala)[0].strip().lower()
pleocr = pleocr.replace('weak', 'ahul')
dispertsioa = ''
if re.search('Dispersion:</div><div class="mindatam2">.*?</',textminerala):
dispertsioa=re.findall('Dispersion:</div><div class="mindatam2">(.*?)</',textminerala)[0].strip().lower()
hiztegia = {'relatively weak':'ahul samarra', 'weak':'ahula', 'strong':'sendo', 'r > v moderate':'r > v moderatu',
'r < v moderate':'r < v moderatu', 'r > v weak':'r > v ahula', 'r < v weak':'r < v ahula',
'r > v strong':'r > v sendo', 'r < v strong':'r < v sendo'}
dispertsioa = hiztegia.get(dispertsioa, dispertsioa+'*')
grup = ''
if re.search("Member of:</span><div class='twocol'><a href=\"min-.*?.html\">",textminerala):
grup = textminerala.split('Member of')
grup=re.findall("Member of:</span><div class='twocol'><a href=\"min-.*?.html\">(.*?)</a>",textminerala)[0].strip().lower()
grup = grup.replace('group', 'taldea')
print grup
ima = ''
if re.search('<a href="min-.*?.html">IMA....-.*?</a>',textminerala):
ima=re.findall('<a href="min-.*?.html">(IMA....-.*?)</a>',textminerala)[0].strip()
magnetismoa = ''
if re.search('Magnetism:</div><div class="mindatam2">.*?</',textminerala):
magnetismoa =re.findall('Magnetism:</div><div class="mindatam2">(.*?)</',textminerala)[0].strip().lower()
magnetismoa = magnetismoa + '*'
import time
eguna = time.strftime('%d')
hilabetea = time.strftime('%m')
urtea = time.strftime('%Y')
hiztegia = {'1':'urtarrila', '2':'otsaila', '3':'martxoa', '4':'apirila', '5':'maiatza', '6':'ekaina', '7':'uztaila', '8':'abuztua',
'9':'iraila', '10':'urria', '11':'azaroa', '12':'abendua'}
referencia = '<ref>{{Erreferentzia|url='+url+'|sartze-data='+eguna+'-'+hilabetea+'-'+urtea+'|izenburua='+nom+': Mineral information, data and localities.|aldizkaria=www.mindat.org|hizkuntza=en}}</ref>'
#referencia = '<ref>{{Erreferentzia|url='+url+'}}</ref>'
estatNum = ''
if re.search('<a href="/glossary/IMA_status">IMA status:</a></div><div class="mindatam2">.*?</d',textminerala):
estat=re.findall('<a href="/glossary/IMA_status">IMA status:</a></div><div class="mindatam2">(.*?)</d',textminerala)[0].strip().lower()
if 'not approved' in estat:
estatNum = 2
else:
estatNum = 1
# Txantiloia muntatzearen zatia hasten da aurkitutako datuekin.
# Mineralentzako mineral infotaularen balioak bete egiten dira lehendabizi.
# plant = '= [[{}]] =\n'.format(nomcat)
# plant = plant + "{{mineral infotaula\n"
plant = "{{mineral infotaula\n"
plant=plant+"| izena = {}\n".format(nomcat)
plant=plant+"| formula = {}\n".format(formula)
plant=plant+"| kategoria = {}\n".format(kategoriaF)
plant=plant+"| irudia = \n"
plant=plant+"| irudiaren testua = \n"
plant=plant+"| egoera IMA = {}\n".format(estatNum)
if nickelstrunz != '':
plant=plant+"| strunz = {}\n".format(nickelstrunz)
if dana != '':
plant=plant+"| dana = {}\n".format(dana)
if heys != '':
plant=plant+"| heys = {}\n".format(heys)
if aurkikuntza != '':
plant=plant+"| any = {}\n".format(aurkikuntza)
if motak != '':
plant=plant+"| localitat = {}\n".format(motak)
if distiraF != '':
plant=plant+"| distira = {}\n".format(distiraF.rstrip(', '))
if gardentasunF != '':
plant=plant+"| gardentasun = {}\n".format(gardentasunF.rstrip(', '))
if koloreF != '':
plant=plant+"| kolorea = {}\n".format(koloreF.rstrip(', '))
if marraF != '':
plant=plant+"| marra = {}\n".format(marraF.rstrip(', '))
if irmotasunaF != '':
plant=plant+"| irmotasuna = {}\n".format(irmotasunaF.rstrip(', '))
if esfoliazio != '':
plant=plant+"| esfoliazioa = {}\n".format(esfoliazio)
if hausketaF != '':
plant=plant+"| fraktura = {}\n".format(hausketaF.rstrip(', '))
if dentsitatea != '':
plant=plant+"| dentsitate = {}\n".format(dentsitatea)
if sistema != '':
plant=plant+"| sistema = {}\n".format(sistema)
if simetria != '':
plant=plant+"| simetria = {}\n".format(simetria)
if egitura != '':
plant=plant+"| zelda = {}\n".format(egitura)
if propoptiques != '':
plant=plant+"| talde-optikoa = {}\n".format(propoptiques)
if errefrakzio != '':
plant=plant+"| errefrakzio_indizea = {}\n".format(errefrakzio)
if birrefringentzia != '':
plant=plant+"| birrefringentzia = {}\n".format(birrefringentzia)
if ezpurutasun != '':
plant=plant+"| ezpurutasuna = {}\n".format(ezpurutasun)
if fluoreszentzia != '':
plant=plant+"| fluoreszentzia = {}\n".format(fluoreszentzia.rstrip('.'))
if macles != '':
plant=plant+"| makla = {}\n".format(macles.rstrip('.'))
if dureza != '':
plant=plant+"| gogortasuna = {}\n".format(dureza)
if angelua != '':
plant=plant+"| 2v= {}\n".format(angelua)
if pleocr != '':
plant=plant+"| pleokroismoa = {}\n".format(pleocr)
if dispertsioa != '':
plant=plant+"| dispertsioa = {}\n".format(dispertsioa)
if ima != '':
plant=plant+"| IMA = {}\n".format(ima)
if magnetismoa != '':
plant=plant+"| magnetismoa = {}\n".format(magnetismoa)
plant=plant+"| erreferentziak = {}\n".format(referencia)
plant=plant+"}}\n"
# Wikipediako artikuluan agertuko den testua imprimatzen du.
if kategoriaF != '!!!':
plant = plant + "'''" + nomcat + "''' " + kategoriaF + " motako [[mineral]]a da"
else:
plant = plant + "'''" + nomcat + "''' " + " [[mineral]] bat da"
if grup != '':
plant = plant + ' eta '+ grup +'ren kidea da. '
else:
plant = plant + '.'
plant = plant + referencia
plant = plant + '\n\n== Ezaugarriak ==\n'
plant = plant + ''+ nomcat +' [['+kategoriaG+']] mineralaren [[formula kimiko]]a hau da: '+formula+'. '
if "*" not in sistemaLuzea:
plant = plant + ''+sistemaLuzea+'ren arabera sortzen ditu kristalak. '
if dureza != '':
plant = plant + '[[Mohs eskala]]ren arabera duen [[gogortasuna]]ren balioa '+dureza+' da. '
plant = plant + '\n\n== Eraketa eta meatokiak =='
plant = plant + '\n\n== Erreferentziak ==\n{{Erreferentzia zerrenda}}\n\n'
if Wiki_kategoriaF != '!!!':
plant = plant + '[[Kategoria:'+Wiki_kategoriaF+']]\n[[Kategoria:Mineralak_Mindat]]'
else:
plant = plant +'\n[[Kategoria:Mineralak_Mindat]]'
#plant = plant + '[[Kategoria:Mineralak]]\n [[Kategoria:Mineralak_Mindat]]'
plant = plant + '{{-}}'
return plant
#Hitz bat emanda deitu egingo dio, hitz horretaz hasten diren mineral guztien horriei
def tratatuorria(hizkia):
urldistr=[]
#urldistr barruan sartu momentuan aztertuko den
urldistr.append('https://www.mindat.org/index-'+hizkia+'.html')
taula=""
for url in urldistr: #[:1]
url=''+url
try:
pagdistr=urllib.urlopen(url)
except IOError:
print("IO errorea irekitzerakoan",url)
continue
textdistr=pagdistr.read()
trosarbres=re.findall('href="(min-[0-9]+.html)"><b>',textdistr)
print(len(trosarbres),u"mineral irakurtzeke "+ hizkia+"rentzat")
# Bilatzeko:
contador = 0
minim = 1
maxim = len(trosarbres)
for tros in trosarbres:
if "min" in tros:
contador = contador + 1
if contador >= minim and contador <= maxim:
print(tros)
irakurrita=irakurriminerala(tros)
try:
taula=taula+irakurrita+"\n"
except UnicodeDecodeError:
print(u"Error unicode. Minerala saltatzen.")
continue
return taula
def lotu_katalanekoekin (nomcat):
#katalanezko wikipedian artikulua badago eta euskarazkoarekin lotuta ez badago ... ltu ezazue elkarrekin
site = pywikibot.Site('ca', 'wikipedia') # any site will work, this is just an example
nomcat1 = nomcat
if 'C' == nomcat[0:1] and nomcat[1:2]!= 'h':
nomcat1 = 'K' + nomcat[1:]
if nomcat == 'Marinaita':
nomcat1 = u'Marinaïta'
if nomcat == 'Imayoshiita':
nomcat1 = u'Imayoshiïta'
izenburua = nomcat1
page = pywikibot.Page(site, nomcat1)
item = pywikibot.ItemPage.fromPage(page) # this can be used for any page object
sitelinks = item.sitelinks
if 'eu' in sitelinks:
print('The label in Basque is: ' + sitelinks['eu'])
else:
#print('There is no label in Basque')
#item.editLabels(labels={'eu': izenburua }, summary=u'Edit label')
#item.editDescriptions(descriptions={'eu': 'Mineral'}, summary=u'Edit description')
item.setSitelink(sitelink={'site': 'euwiki', 'title': nomcat}, summary=u'Set sitelink in Basque')
if 'eu' in item.labels:
print('The label in Basque is: ' + item.labels['eu'])
else:
print('There is no label in Basque')
item.editLabels(labels={'eu': izenburua }, summary=u'Edit label')
item.editDescriptions(descriptions={'eu': 'mineral'}, summary=u'Edit description')
item.setSitelink(sitelink={'site': 'euwiki', 'title': izenburua}, summary=u'Set sitelink in Basque')
def lotu_wdatarekin (url, informe1):
# #katalanezko wikipedian artikulua badago eta euskarazkoarekin lotuta ez badago ... ltu ezazue elkarrekin
# site = pywikibot.Site('ca', 'wikipedia') # any site will work, this is just an example
# nomcat1 = nomcat
# if 'C' == nomcat[0:1] and nomcat[1:2]!= 'h':
# nomcat1 = 'K' + nomcat[1:]
# if nomcat == 'Marinaita':
# nomcat1 = u'Marinaïta'
# if nomcat == 'Imayoshiita':
# nomcat1 = u'Imayoshiïta'
# izenburua = nomcat1
# page = pywikibot.Page(site, nomcat1)
hiztegi_wdata = {1: 'Q318777' , 10: 'Q413498' , 1002: 'Q3667576' , 1003: 'Q411566' , 1004: 'Q3674713' , 1006: 'Q3675033' , 1007: 'Q2729670' , 10103: 'Q106532' , 1014: 'Q410592' , 1017: 'Q531280' , 10174: 'Q3636189' , 10175: 'Q1171888' , 1018: 'Q3675283' , 1027: 'Q2705431' , 1030: 'Q3675902' , 1031: 'Q3675916' , 10315: 'Q2048382' , 10316: 'Q3833410' , 10317: 'Q3843933' , 10318: 'Q3904976' , 10319: 'Q4020781' , 10333: 'Q3746841' , 10343: 'Q3742415' , 10344: 'Q410903' , 1035: 'Q1087675' , 10386: 'Q1723332' , 1039: 'Q422179' , 10392: 'Q3886227' , 10397: 'Q3907727' , 1040: 'Q407485' , 10408: 'Q1314199' , 10409: 'Q420826' , 10417: 'Q316671' , 1043: 'Q3676058' , 1045: 'Q3676065' , 10463: 'Q182264' , 1047: 'Q1089901' , 10482: 'Q422128' , 1049: 'Q3676119' , 1051: 'Q3676265' , 1052: 'Q104614' , 1055: 'Q203444' , 10552: 'Q380674' , 1057: 'Q2975526' , 10575: 'Q978346' , 1058: 'Q3679115' , 1059: 'Q1062405' , 1060: 'Q747742' , 10605: 'Q1070595' , 1061: 'Q420853' , 1062: 'Q42302' , 1062: 'Q42302' , 1064: 'Q3680699' , 1065: 'Q3680774' , 10655: 'Q3853924' , 1066: 'Q3680777' , 1078: 'Q3680794' , 1079: 'Q3680795' , 10798: 'Q3866448' , 10804: 'Q1746095' , 1081: 'Q1117109' , 10810: 'Q4023583' , 10811: 'Q204305' , 10814: 'Q3199781' , 1083: 'Q3680799' , 1097: 'Q3681864' , 1098: 'Q3681866' , 1099: 'Q3681854' , 10994: 'Q3895284' , 10995: 'Q811625' , 10997: 'Q3357526' , 10999: 'Q3742066' , 1100: 'Q430112' , 11001: 'Q3644832' , 11002: 'Q3647552' , 11003: 'Q3826925' , 11004: 'Q3876057' , 11005: 'Q3873290' , 11007: 'Q3886229' , 11008: 'Q1056068' , 1101: 'Q3681954' , 11010: 'Q3840571' , 11013: 'Q3999942' , 11019: 'Q1443505' , 1102: 'Q3681993' , 11028: 'Q3960057' , 11029: 'Q3742064' , 11033: 'Q3979101' , 1104: 'Q424335' , 1106: 'Q423372' , 1107: 'Q419137' , 1108: 'Q2293541' , 1109: 'Q13092' , 1110: 'Q416294' , 1111: 'Q3683752' , 11112: 'Q3991789' , 11114: 'Q3743243' , 11118: 'Q3844522' , 1124: 'Q651700' , 1128: 'Q410336' , 1129: 'Q3693435' , 1130: 'Q2997400' , 1131: 'Q2997617' , 1132: 'Q1065048' , 11337: 'Q3966615' , 11338: 'Q3641428' , 1134: 'Q3693975' , 11345: 'Q13365059' , 1135: 'Q3694401' , 1136: 'Q131777' , 11378: 'Q425788' , 11379: 'Q3876061' , 11383: 'Q3775888' , 1140: 'Q3695712' , 1141: 'Q425639' , 11414: 'Q43513' , 11414: 'Q43513' , 1142: 'Q3696040' , 11424: 'Q3825203' , 11425: 'Q3825201' , 1143: 'Q3696270' , 11433: 'Q3743172' , 11435: 'Q3959635' , 11436: 'Q2251920' , 11437: 'Q3835088' , 11439: 'Q1070924' , 1144: 'Q325345' , 11440: 'Q3830124' , 11445: 'Q3843296' , 11446: 'Q3843297' , 11447: 'Q3843294' , 11448: 'Q3843293' , 1148: 'Q3696717' , 1158: 'Q2706053' , 1159: 'Q430083' , 1161: 'Q193502' , 1163: 'Q3698830' , 1164: 'Q3559150' , 11664: 'Q318777' , 11665: 'Q318777' , 11667: 'Q319661' , 11668: 'Q320694' , 11669: 'Q320694' , 1167: 'Q3699020' , 11676: 'Q333593' , 11677: 'Q333593' , 11678: 'Q413498' , 11679: 'Q413498' , 1168: 'Q424923' , 11690: 'Q104692' , 11691: 'Q104692' , 11692: 'Q344688' , 11693: 'Q344688' , 11694: 'Q111200' , 11695: 'Q111200' , 11698: 'Q355210' , 11699: 'Q355210' , 1170: 'Q418873' , 11704: 'Q359343' , 11705: 'Q359343' , 11706: 'Q3720433' , 11708: 'Q380942' , 11709: 'Q380942' , 1171: 'Q430065' , 11710: 'Q381133' , 11711: 'Q381133' , 11714: 'Q1935056' , 11715: 'Q1935056' , 11717: 'Q978346' , 11718: 'Q2518702' , 11719: 'Q2518702' , 1172: 'Q407335' , 11723: 'Q19799540' , 11732: 'Q396466' , 11733: 'Q396466' , 11736: 'Q398382' , 11737: 'Q398382' , 11738: 'Q1070576' , 11739: 'Q1070576' , 11740: 'Q1129950' , 11744: 'Q404955' , 11745: 'Q404955' , 11748: 'Q413128' , 11749: 'Q413128' , 11750: 'Q2251499' , 11751: 'Q2251499' , 11756: 'Q270942' , 11758: 'Q3607328' , 11760: 'Q420570' , 11764: 'Q1059805' , 1177: 'Q3699568' , 11784: 'Q413440' , 11785: 'Q413440' , 11788: 'Q1075708' , 11789: 'Q1075708' , 11794: 'Q182264' , 11795: 'Q182264' , 1181: 'Q3699569' , 11810: 'Q414132' , 11811: 'Q414132' , 11824: 'Q1853054' , 11825: 'Q1853054' , 11828: 'Q429647' , 11829: 'Q429647' , 1186: 'Q3699570' , 11865: 'Q2629082' , 1187: 'Q3699572' , 11873: 'Q1063305' , 11875: 'Q416672' , 11876: 'Q3613187' , 1188: 'Q3699573' , 11881: 'Q4736725' , 11886: 'Q413750' , 11887: 'Q413750' , 1189: 'Q1125562' , 11900: 'Q338106' , 11901: 'Q338106' , 11904: 'Q4063088' , 11934: 'Q454926' , 11937: 'Q3613655' , 11938: 'Q429786' , 11939: 'Q429786' , 11946: 'Q410329' , 1197: 'Q416942' , 1198: 'Q3699738' , 11986: 'Q478080' , 11988: 'Q423458' , 11989: 'Q423458' , 11996: 'Q192637' , 11997: 'Q192637' , 12000: 'Q3615369' , 12004: 'Q280913' , 12005: 'Q280913' , 12012: 'Q525059' , 12024: 'Q156526' , 12025: 'Q156526' , 12030: 'Q3617482' , 12037: 'Q120481' , 12039: 'Q414149' , 12040: 'Q3618110' , 12050: 'Q244994' , 12056: 'Q415984' , 12061: 'Q3618552' , 12062: 'Q413322' , 1211: 'Q3700167' , 12120: 'Q704779' , 12121: 'Q704779' , 12126: 'Q410143' , 1213: 'Q3700777' , 12134: 'Q704772' , 12138: 'Q191939' , 1214: 'Q3701193' , 12143: 'Q23775' , 12148: 'Q625716' , 12149: 'Q625716' , 1215: 'Q3701213' , 12152: 'Q1057106' , 12153: 'Q1057106' , 12168: 'Q643629' , 1217: 'Q1159281' , 12177: 'Q2008960' , 12178: 'Q2008960' , 1218: 'Q424270' , 12187: 'Q422351' , 12188: 'Q422351' , 12189: 'Q425364' , 1219: 'Q3702136' , 12193: 'Q3622477' , 12205: 'Q416983' , 12206: 'Q416983' , 12209: 'Q12981339' , 1222: 'Q3702452' , 12229: 'Q3623959' , 1224: 'Q3702465' , 1225: 'Q3702475' , 12253: 'Q704808' , 1229: 'Q5227830' , 1230: 'Q1172805' , 12306: 'Q409775' , 1263: 'Q3705832' , 12636: 'Q3637474' , 1265: 'Q3705896' , 12656: 'Q3637798' , 1266: 'Q3705912' , 12669: 'Q3637915' , 1267: 'Q417292' , 12672: 'Q2895664' , 12674: 'Q411137' , 12675: 'Q411137' , 12679: 'Q424786' , 12681: 'Q2896152' , 12682: 'Q2251934' , 12683: 'Q2251934' , 12684: 'Q957922' , 12685: 'Q957922' , 12688: 'Q411505' , 12689: 'Q411505' , 1269: 'Q3706013' , 12692: 'Q418521' , 12693: 'Q418521' , 12696: 'Q3638660' , 12698: 'Q3638749' , 12699: 'Q3638749' , 1270: 'Q2238642' , 12704: 'Q418689' , 12705: 'Q418689' , 12708: 'Q2582855' , 12709: 'Q2582855' , 12712: 'Q2040729' , 12716: 'Q19890838' , 12718: 'Q420797' , 12719: 'Q420797' , 12724: 'Q225550' , 12725: 'Q225550' , 12728: 'Q3639255' , 1273: 'Q3706350' , 12749: 'Q3639748' , 1276: 'Q13094' , 12764: 'Q422316' , 12765: 'Q422316' , 12768: 'Q3640023' , 1282: 'Q5283' , 1285: 'Q411891' , 1294: 'Q316671' , 1295: 'Q413369' , 1298: 'Q3712204' , 1304: 'Q167741' , 13121: 'Q3655104' , 13173: 'Q409781' , 13174: 'Q409781' , 13175: 'Q409100' , 13176: 'Q409100' , 13177: 'Q409803' , 13178: 'Q409803' , 1318: 'Q2482759' , 1319: 'Q3039376' , 13195: 'Q191222' , 13196: 'Q191222' , 1320: 'Q3715339' , 13201: 'Q422339' , 13202: 'Q422339' , 13203: 'Q422857' , 13204: 'Q422857' , 13207: 'Q338119' , 13209: 'Q425142' , 1321: 'Q3715525' , 13210: 'Q425142' , 13213: 'Q409122' , 13214: 'Q2150822' , 13215: 'Q2150822' , 1322: 'Q3715593' , 13221: 'Q1057606' , 13228: 'Q1057733' , 13237: 'Q617097' , 1324: 'Q422333' , 13246: 'Q111044' , 13248: 'Q727306' , 1325: 'Q409433' , 13250: 'Q3665704' , 13258: 'Q278106' , 1326: 'Q3716119' , 13268: 'Q420478' , 13269: 'Q420478' , 13270: 'Q3666204' , 13274: 'Q420180' , 13275: 'Q420180' , 13276: 'Q1118625' , 13278: 'Q422167' , 1328: 'Q3716229' , 13280: 'Q3666837' , 13282: 'Q3666867' , 13283: 'Q3666867' , 1329: 'Q677619' , 1330: 'Q126204' , 13312: 'Q3667211' , 1332: 'Q3041518' , 13320: 'Q3667272' , 13497: 'Q419137' , 13498: 'Q2293541' , 13499: 'Q2293541' , 1350: 'Q3719013' , 13502: 'Q416294' , 13503: 'Q416294' , 13506: 'Q899841' , 13507: 'Q899841' , 13508: 'Q1112922' , 1352: 'Q3719076' , 13520: 'Q421037' , 13521: 'Q421037' , 13522: 'Q417473' , 13523: 'Q417473' , 13528: 'Q1059093' , 13529: 'Q1059093' , 13531: 'Q651700' , 13534: 'Q414816' , 13535: 'Q414816' , 13538: 'Q410336' , 13539: 'Q410336' , 1354: 'Q3719719' , 13544: 'Q1065048' , 13545: 'Q1065048' , 13548: 'Q3693975' , 13549: 'Q3693975' , 1355: 'Q3720264' , 13556: 'Q1135968' , 1356: 'Q3720326' , 13560: 'Q425639' , 13561: 'Q425639' , 13566: 'Q325345' , 1357: 'Q3720472' , 13572: 'Q429813' , 13574: 'Q3696717' , 1358: 'Q3720608' , 13580: 'Q382754' , 13581: 'Q382754' , 13588: 'Q3697144' , 1359: 'Q3720626' , 13590: 'Q422075' , 13591: 'Q422075' , 13594: 'Q422903' , 13595: 'Q422903' , 13596: 'Q2706053' , 13597: 'Q2706053' , 13598: 'Q430083' , 13599: 'Q430083' , 1361: 'Q2252707' , 13614: 'Q424923' , 13615: 'Q424923' , 13616: 'Q418873' , 13617: 'Q418873' , 13618: 'Q430065' , 1362: 'Q3720811' , 13620: 'Q407335' , 13621: 'Q407335' , 1363: 'Q3718487' , 1364: 'Q1920794' , 1366: 'Q3723499' , 13664: 'Q1144552' , 13667: 'Q416942' , 13676: 'Q421020' , 1368: 'Q3723545' , 13684: 'Q424094' , 13686: 'Q3667124' , 13688: 'Q339530' , 1369: 'Q1301508' , 13693: 'Q3700777' , 1375: 'Q43513' , 1375: 'Q43513' , 1380: 'Q411881' , 13832: 'Q3712204' , 1389: 'Q272844' , 1407: 'Q247914' , 1414: 'Q420287' , 14148: 'Q417387' , 14149: 'Q417387' , 1415: 'Q3734119' , 1417: 'Q2632186' , 14170: 'Q2250996' , 1419: 'Q1077131' , 142: 'Q2629082' , 1420: 'Q419270' , 14204: 'Q3743232' , 1421: 'Q1372252' , 14212: 'Q3743238' , 14222: 'Q1407970' , 1423: 'Q3734472' , 1424: 'Q3734518' , 1425: 'Q1146596' , 14250: 'Q1408085' , 14252: 'Q3743842' , 14256: 'Q3743850' , 14257: 'Q3743850' , 1426: 'Q415880' , 14262: 'Q413639' , 14263: 'Q413639' , 14266: 'Q3744517' , 14268: 'Q1057224' , 14269: 'Q1057224' , 1427: 'Q3735298' , 14270: 'Q3745378' , 14271: 'Q3745378' , 1428: 'Q13536972' , 14282: 'Q1119933' , 14286: 'Q3746564' , 1429: 'Q3735754' , 14292: 'Q3755484' , 14294: 'Q3746703' , 14295: 'Q3746703' , 14299: 'Q428379' , 14306: 'Q416275' , 14307: 'Q416275' , 1431: 'Q3736318' , 14310: 'Q3746844' , 14311: 'Q3746844' , 1432: 'Q3736442' , 14321: 'Q1065167' , 14323: 'Q415037' , 1433: 'Q3737571' , 14332: 'Q2252335' , 14339: 'Q417443' , 14345: 'Q3490672' , 14349: 'Q418094' , 1435: 'Q3738375' , 14350: 'Q418094' , 1436: 'Q1112021' , 14363: 'Q2249248' , 14364: 'Q2249248' , 14365: 'Q410810' , 14366: 'Q410810' , 14369: 'Q3753125' , 14375: 'Q1469279' , 14381: 'Q3753635' , 14383: 'Q1470345' , 1439: 'Q3738431' , 14393: 'Q3754133' , 14405: 'Q3757195' , 14407: 'Q375357' , 14408: 'Q375357' , 14419: 'Q414877' , 1442: 'Q3738438' , 14420: 'Q414877' , 14423: 'Q424112' , 14424: 'Q424112' , 14425: 'Q3045746' , 14426: 'Q3045746' , 14427: 'Q411230' , 14428: 'Q411230' , 1443: 'Q3738453' , 14443: 'Q45163524' , 14445: 'Q3758444' , 14449: 'Q412947' , 14455: 'Q3099383' , 14459: 'Q420793' , 1446: 'Q3738647' , 14460: 'Q420793' , 1473: 'Q3742061' , 14731: 'Q1065515' , 14732: 'Q1065515' , 14738: 'Q677580' , 1475: 'Q3742405' , 14757: 'Q3783667' , 1476: 'Q417387' , 14762: 'Q420316' , 14763: 'Q383713' , 14764: 'Q383713' , 14765: 'Q411830' , 14766: 'Q411830' , 14769: 'Q430074' , 1477: 'Q1405017' , 14776: 'Q2249072' , 14779: 'Q3129310' , 1478: 'Q19963556' , 14782: 'Q422984' , 1479: 'Q3742785' , 14791: 'Q429570' , 14792: 'Q429570' , 14798: 'Q3784699' , 14799: 'Q3784724' , 1480: 'Q3742784' , 14804: 'Q103223' , 14809: 'Q3784779' , 14811: 'Q408008' , 14815: 'Q422318' , 1482: 'Q3809694' , 14823: 'Q3130295' , 14827: 'Q3784895' , 14835: 'Q377086' , 1484: 'Q3743001' , 14845: 'Q418863' , 14846: 'Q418863' , 1485: 'Q3743140' , 14850: 'Q3785368' , 14857: 'Q408196' , 14858: 'Q408196' , 14861: 'Q1466985' , 14862: 'Q1466985' , 14865: 'Q1616655' , 14875: 'Q3785452' , 14881: 'Q3785465' , 14888: 'Q3785626' , 1490: 'Q3743175' , 1493: 'Q2250996' , 1495: 'Q3743190' , 1496: 'Q2424058' , 1497: 'Q3743191' , 1498: 'Q3743193' , 1499: 'Q3743194' , 1500: 'Q3743195' , 15000: 'Q2738366' , 1501: 'Q3743197' , 15626: 'Q3826891' , 15720: 'Q3830198' , 1576: 'Q102151' , 1610: 'Q3753266' , 162: 'Q420958' , 1641: 'Q37559' , 16429: 'Q3322601' , 16646: 'Q3874703' , 16751: 'Q3879321' , 16754: 'Q3879976' , 1683: 'Q415856' , 1710: 'Q423034' , 1719: 'Q189703' , 18: 'Q104692' , 1804: 'Q5314' , 1809: 'Q417278' , 18169: 'Q3973238' , 1831: 'Q420316' , 18366: 'Q3980304' , 1856: 'Q103223' , 18588: 'Q3995714' , 19253: 'Q4023579' , 1992: 'Q413478' , 2: 'Q2294982' , 2013: 'Q190729' , 2072: 'Q415818' , 210: 'Q239589' , 2156: 'Q223197' , 2187: 'Q420537' , 21965: 'Q3941515' , 2303: 'Q193450' , 2321: 'Q3826891' , 234: 'Q105439' , 239: 'Q120481' , 240: 'Q414149' , 25274: 'Q3980907' , 26094: 'Q4021124' , 262: 'Q1099' , 268: 'Q417254' , 27424: 'Q3816088' , 2763: 'Q3322601' , 2815: 'Q106532' , 2879: 'Q3874703' , 2945: 'Q3879976' , 3021: 'Q419183' , 307: 'Q23775' , 31211: 'Q3816088' , 31570: 'Q182344' , 3337: 'Q43010' , 36766: 'Q682' , 3782: 'Q421831' , 4000: 'Q3995714' , 40179: 'Q19833676' , 40570: 'Q412784' , 4070: 'Q1934730' , 4159: 'Q3189938' , 422: 'Q410369' , 4433: 'Q230181' , 447: 'Q108212' , 4509: 'Q143447' , 4788: 'Q942' , 48: 'Q1070595' , 53294: 'Q60621049' , 549: 'Q184196' , 628: 'Q2251934' , 727: 'Q108694' , 738: 'Q250618' , 741: 'Q413314' , 787: 'Q410609' , 790: 'Q2896415' , 791: 'Q3645538' , 793: 'Q2251961' , 794: 'Q3646279' , 795: 'Q3646300' , 796: 'Q1070902' , 797: 'Q3646769' , 800: 'Q13114' , 801: 'Q1009724' , 803: 'Q3647236' , 806: 'Q3647435' , 808: 'Q3647463' , 810: 'Q1113496' , 811: 'Q3647740' , 813: 'Q4101132' , 814: 'Q570184' , 817: 'Q3638277' , 818: 'Q2235148' , 820: 'Q419250' , 8212: 'Q3817441' , 831: 'Q3650481' , 832: 'Q3650477' , 834: 'Q3650486' , 8380: 'Q25381' , 849: 'Q3649567' , 850: 'Q3649572' , 851: 'Q3649812' , 852: 'Q414999' , 854: 'Q3650236' , 855: 'Q3650468' , 856: 'Q3650470' , 859: 'Q171917' , 860: 'Q3650476' , 861: 'Q3650488' , 862: 'Q959680' , 863: 'Q3650522' , 864: 'Q429522' , 865: 'Q383624' , 867: 'Q3650789' , 868: 'Q3650824' , 869: 'Q4517638' , 871: 'Q3651093' , 872: 'Q657684' , 8738: 'Q2843949' , 874: 'Q3651367' , 877: 'Q3655104' , 878: 'Q3655118' , 879: 'Q3655127' , 880: 'Q417444' , 881: 'Q3655162' , 882: 'Q3655328' , 883: 'Q3655422' , 8864: 'Q3787382' , 889: 'Q3657310' , 89: 'Q420563' , 890: 'Q3658165' , 891: 'Q3658269' , 892: 'Q3658270' , 893: 'Q3658275' , 894: 'Q3658291' , 898: 'Q1070792' , 90: 'Q143447' , 900: 'Q3658900' , 902: 'Q3660153' , 9020: 'Q417421' , 903: 'Q3660152' , 904: 'Q5042890' , 905: 'Q3660390' , 906: 'Q409781' , 907: 'Q409100' , 908: 'Q409803' , 9081: 'Q156526' , 909: 'Q3660669' , 910: 'Q3660707' , 911: 'Q1058717' , 914: 'Q3661527' , 916: 'Q3661996' , 917: 'Q191222' , 920: 'Q422339' , 921: 'Q422857' , 922: 'Q3664035' , 923: 'Q3664060' , 924: 'Q3664062' , 925: 'Q338119' , 926: 'Q425142' , 9263: 'Q1143781' , 927: 'Q407221' , 928: 'Q429534' , 929: 'Q3665101' , 9294: 'Q3704572' , 9333: 'Q324369' , 934: 'Q409122' , 935: 'Q3665221' , 936: 'Q2150822' , 939: 'Q1057606' , 94: 'Q1070610' , 941: 'Q3665625' , 943: 'Q1057733' , 945: 'Q3650518' , 946: 'Q3675291' , 948: 'Q48772418' , 954: 'Q3665757' , 955: 'Q111044' , 956: 'Q727306' , 957: 'Q3665704' , 958: 'Q3665738' , 959: 'Q407861' , 96: 'Q182264' , 960: 'Q170448' , 961: 'Q3650494' , 962: 'Q278106' , 965: 'Q3666093' , 966: 'Q3666057' , 967: 'Q420478' , 968: 'Q3666204' , 969: 'Q3666242' , 970: 'Q420180' , 971: 'Q1118625' , 972: 'Q422167' , 973: 'Q3666837' , 974: 'Q3666867' , 978: 'Q3665758' , 979: 'Q420293' , 9796: 'Q6817061' , 982: 'Q3675294' , 985: 'Q3667036' , 987: 'Q3667129' , 989: 'Q3667191' , 991: 'Q3667211' , 992: 'Q3667215' , 993: 'Q3667216' , 995: 'Q2962810' , 996: 'Q3667267' , 997: 'Q3667272' , 998: 'Q3667273' }
mindata_id = int(url[4:-5])
# mindata_id = int('852')
wdata_ID = hiztegi_wdata.get(mindata_id,'!!!!')
print mindata_id
print wdata_ID
site = pywikibot.Site('eu', 'wikipedia') # any site will work, this is just an example
repo = site.data_repository() # this is a DataSite object
item = pywikibot.ItemPage(repo, wdata_ID)
item.get() # you need to call it to access any data.
sitelinks = item.sitelinks
print sitelinks
EU_labela = sitelinks['cawiki'] # Artikuluaren izenburua katalenezkoa bera izango da.
print informe1[:100]
desti=pywikibot.Page(site,EU_labela)
desti.put(informe1,u"Automatikoki sortua mindat.org webguneko datuekin")
if 'eu' in item.labels:
print('The label in Basque is: ' + item.labels['eu'])
else:
print('There is no label in Basque')
item.editLabels(labels={'eu': sitelinks['cawiki'] }, summary=u'Edit label')
item.editDescriptions(descriptions={'eu': 'mineral'}, summary=u'Edit description')
# item.setSitelink(sitelink={'site': 'euwiki', 'title': sitelinks['cawiki']}, summary=u'Set sitelink in Basque')
if 'euwiki' in sitelinks:
print('The label in Basque is: ' + sitelinks['euwiki'])
else:
#print('There is no label in Basque')
#item.editLabels(labels={'eu': izenburua }, summary=u'Edit label')
#item.editDescriptions(descriptions={'eu': 'Mineral'}, summary=u'Edit description')
item.setSitelink(sitelink={'site': 'euwiki', 'title': sitelinks['cawiki']}, summary=u'Set sitelink in Basque')
#kepa2019-04-29
def proba_mineral_batekin (url1):
informe=irakurriminerala(url1)
informe=unialerroa(informe)
#Euskal wikipedian, adierazten den proba orrian Wikipediako zirriborroa sortzen da, letra bakoitzarentzat orri desberdina izango da.
site=pywikibot.Site('eu')
# desti=pywikibot.Page(site,u"Lankide:EUmineralbot/Proba-"+url1[:-5])
# desti.put(informe,u"Proba mineral batekin mindat.org-eko datuekin")
## desti=pywikibot.Page(site,u"Lankide:EUmineralbot/Proba-"+url1[:-5])
## desti.put(informe,u"Proba mineral batekin mindat.org-eko datuekin")
# lotu_katalanekoekin ('calaverita')
lotu_wdatarekin(url1, informe)
url89 = "min-1003.html" #calaverita Q414999
#url89 = "min-852.html" #calaverita Q414999
#url89 = "min-44007.html" #imayoshiïta
#url89 = "min-47930.html" #folvikita
#url89 = "min-47919.html" #marinaita
#url89 = "min-1362.html" #Ekaterinita
proba_mineral_batekin (url89)
#url89 = "min-879.html" #Canavesita"
#url89 = "min-89.html" #Alabandite"
#=====================================================
#2019-05-12an wikidatan mindat propietatea dutenak eta euwikin ez dauden mineralak sartu
hiztegi_wdata = {1: 'Q318777' , 10: 'Q413498' , 1002: 'Q3667576' , 1003: 'Q411566' , 1004: 'Q3674713' , 1006: 'Q3675033' , 1007: 'Q2729670' , 10103: 'Q106532' , 1014: 'Q410592' , 1017: 'Q531280' , 10174: 'Q3636189' , 10175: 'Q1171888' , 1018: 'Q3675283' , 1027: 'Q2705431' , 1030: 'Q3675902' , 1031: 'Q3675916' , 10315: 'Q2048382' , 10316: 'Q3833410' , 10317: 'Q3843933' , 10318: 'Q3904976' , 10319: 'Q4020781' , 10333: 'Q3746841' , 10343: 'Q3742415' , 10344: 'Q410903' , 1035: 'Q1087675' , 10386: 'Q1723332' , 1039: 'Q422179' , 10392: 'Q3886227' , 10397: 'Q3907727' , 1040: 'Q407485' , 10408: 'Q1314199' , 10409: 'Q420826' , 10417: 'Q316671' , 1043: 'Q3676058' , 1045: 'Q3676065' , 10463: 'Q182264' , 1047: 'Q1089901' , 10482: 'Q422128' , 1049: 'Q3676119' , 1051: 'Q3676265' , 1052: 'Q104614' , 1055: 'Q203444' , 10552: 'Q380674' , 1057: 'Q2975526' , 10575: 'Q978346' , 1058: 'Q3679115' , 1059: 'Q1062405' , 1060: 'Q747742' , 10605: 'Q1070595' , 1061: 'Q420853' , 1062: 'Q42302' , 1062: 'Q42302' , 1064: 'Q3680699' , 1065: 'Q3680774' , 10655: 'Q3853924' , 1066: 'Q3680777' , 1078: 'Q3680794' , 1079: 'Q3680795' , 10798: 'Q3866448' , 10804: 'Q1746095' , 1081: 'Q1117109' , 10810: 'Q4023583' , 10811: 'Q204305' , 10814: 'Q3199781' , 1083: 'Q3680799' , 1097: 'Q3681864' , 1098: 'Q3681866' , 1099: 'Q3681854' , 10994: 'Q3895284' , 10995: 'Q811625' , 10997: 'Q3357526' , 10999: 'Q3742066' , 1100: 'Q430112' , 11001: 'Q3644832' , 11002: 'Q3647552' , 11003: 'Q3826925' , 11004: 'Q3876057' , 11005: 'Q3873290' , 11007: 'Q3886229' , 11008: 'Q1056068' , 1101: 'Q3681954' , 11010: 'Q3840571' , 11013: 'Q3999942' , 11019: 'Q1443505' , 1102: 'Q3681993' , 11028: 'Q3960057' , 11029: 'Q3742064' , 11033: 'Q3979101' , 1104: 'Q424335' , 1106: 'Q423372' , 1107: 'Q419137' , 1108: 'Q2293541' , 1109: 'Q13092' , 1110: 'Q416294' , 1111: 'Q3683752' , 11112: 'Q3991789' , 11114: 'Q3743243' , 11118: 'Q3844522' , 1124: 'Q651700' , 1128: 'Q410336' , 1129: 'Q3693435' , 1130: 'Q2997400' , 1131: 'Q2997617' , 1132: 'Q1065048' , 11337: 'Q3966615' , 11338: 'Q3641428' , 1134: 'Q3693975' , 11345: 'Q13365059' , 1135: 'Q3694401' , 1136: 'Q131777' , 11378: 'Q425788' , 11379: 'Q3876061' , 11383: 'Q3775888' , 1140: 'Q3695712' , 1141: 'Q425639' , 11414: 'Q43513' , 11414: 'Q43513' , 1142: 'Q3696040' , 11424: 'Q3825203' , 11425: 'Q3825201' , 1143: 'Q3696270' , 11433: 'Q3743172' , 11435: 'Q3959635' , 11436: 'Q2251920' , 11437: 'Q3835088' , 11439: 'Q1070924' , 1144: 'Q325345' , 11440: 'Q3830124' , 11445: 'Q3843296' , 11446: 'Q3843297' , 11447: 'Q3843294' , 11448: 'Q3843293' , 1148: 'Q3696717' , 1158: 'Q2706053' , 1159: 'Q430083' , 1161: 'Q193502' , 1163: 'Q3698830' , 1164: 'Q3559150' , 11664: 'Q318777' , 11665: 'Q318777' , 11667: 'Q319661' , 11668: 'Q320694' , 11669: 'Q320694' , 1167: 'Q3699020' , 11676: 'Q333593' , 11677: 'Q333593' , 11678: 'Q413498' , 11679: 'Q413498' , 1168: 'Q424923' , 11690: 'Q104692' , 11691: 'Q104692' , 11692: 'Q344688' , 11693: 'Q344688' , 11694: 'Q111200' , 11695: 'Q111200' , 11698: 'Q355210' , 11699: 'Q355210' , 1170: 'Q418873' , 11704: 'Q359343' , 11705: 'Q359343' , 11706: 'Q3720433' , 11708: 'Q380942' , 11709: 'Q380942' , 1171: 'Q430065' , 11710: 'Q381133' , 11711: 'Q381133' , 11714: 'Q1935056' , 11715: 'Q1935056' , 11717: 'Q978346' , 11718: 'Q2518702' , 11719: 'Q2518702' , 1172: 'Q407335' , 11723: 'Q19799540' , 11732: 'Q396466' , 11733: 'Q396466' , 11736: 'Q398382' , 11737: 'Q398382' , 11738: 'Q1070576' , 11739: 'Q1070576' , 11740: 'Q1129950' , 11744: 'Q404955' , 11745: 'Q404955' , 11748: 'Q413128' , 11749: 'Q413128' , 11750: 'Q2251499' , 11751: 'Q2251499' , 11756: 'Q270942' , 11758: 'Q3607328' , 11760: 'Q420570' , 11764: 'Q1059805' , 1177: 'Q3699568' , 11784: 'Q413440' , 11785: 'Q413440' , 11788: 'Q1075708' , 11789: 'Q1075708' , 11794: 'Q182264' , 11795: 'Q182264' , 1181: 'Q3699569' , 11810: 'Q414132' , 11811: 'Q414132' , 11824: 'Q1853054' , 11825: 'Q1853054' , 11828: 'Q429647' , 11829: 'Q429647' , 1186: 'Q3699570' , 11865: 'Q2629082' , 1187: 'Q3699572' , 11873: 'Q1063305' , 11875: 'Q416672' , 11876: 'Q3613187' , 1188: 'Q3699573' , 11881: 'Q4736725' , 11886: 'Q413750' , 11887: 'Q413750' , 1189: 'Q1125562' , 11900: 'Q338106' , 11901: 'Q338106' , 11904: 'Q4063088' , 11934: 'Q454926' , 11937: 'Q3613655' , 11938: 'Q429786' , 11939: 'Q429786' , 11946: 'Q410329' , 1197: 'Q416942' , 1198: 'Q3699738' , 11986: 'Q478080' , 11988: 'Q423458' , 11989: 'Q423458' , 11996: 'Q192637' , 11997: 'Q192637' , 12000: 'Q3615369' , 12004: 'Q280913' , 12005: 'Q280913' , 12012: 'Q525059' , 12024: 'Q156526' , 12025: 'Q156526' , 12030: 'Q3617482' , 12037: 'Q120481' , 12039: 'Q414149' , 12040: 'Q3618110' , 12050: 'Q244994' , 12056: 'Q415984' , 12061: 'Q3618552' , 12062: 'Q413322' , 1211: 'Q3700167' , 12120: 'Q704779' , 12121: 'Q704779' , 12126: 'Q410143' , 1213: 'Q3700777' , 12134: 'Q704772' , 12138: 'Q191939' , 1214: 'Q3701193' , 12143: 'Q23775' , 12148: 'Q625716' , 12149: 'Q625716' , 1215: 'Q3701213' , 12152: 'Q1057106' , 12153: 'Q1057106' , 12168: 'Q643629' , 1217: 'Q1159281' , 12177: 'Q2008960' , 12178: 'Q2008960' , 1218: 'Q424270' , 12187: 'Q422351' , 12188: 'Q422351' , 12189: 'Q425364' , 1219: 'Q3702136' , 12193: 'Q3622477' , 12205: 'Q416983' , 12206: 'Q416983' , 12209: 'Q12981339' , 1222: 'Q3702452' , 12229: 'Q3623959' , 1224: 'Q3702465' , 1225: 'Q3702475' , 12253: 'Q704808' , 1229: 'Q5227830' , 1230: 'Q1172805' , 12306: 'Q409775' , 1263: 'Q3705832' , 12636: 'Q3637474' , 1265: 'Q3705896' , 12656: 'Q3637798' , 1266: 'Q3705912' , 12669: 'Q3637915' , 1267: 'Q417292' , 12672: 'Q2895664' , 12674: 'Q411137' , 12675: 'Q411137' , 12679: 'Q424786' , 12681: 'Q2896152' , 12682: 'Q2251934' , 12683: 'Q2251934' , 12684: 'Q957922' , 12685: 'Q957922' , 12688: 'Q411505' , 12689: 'Q411505' , 1269: 'Q3706013' , 12692: 'Q418521' , 12693: 'Q418521' , 12696: 'Q3638660' , 12698: 'Q3638749' , 12699: 'Q3638749' , 1270: 'Q2238642' , 12704: 'Q418689' , 12705: 'Q418689' , 12708: 'Q2582855' , 12709: 'Q2582855' , 12712: 'Q2040729' , 12716: 'Q19890838' , 12718: 'Q420797' , 12719: 'Q420797' , 12724: 'Q225550' , 12725: 'Q225550' , 12728: 'Q3639255' , 1273: 'Q3706350' , 12749: 'Q3639748' , 1276: 'Q13094' , 12764: 'Q422316' , 12765: 'Q422316' , 12768: 'Q3640023' , 1282: 'Q5283' , 1285: 'Q411891' , 1294: 'Q316671' , 1295: 'Q413369' , 1298: 'Q3712204' , 1304: 'Q167741' , 13121: 'Q3655104' , 13173: 'Q409781' , 13174: 'Q409781' , 13175: 'Q409100' , 13176: 'Q409100' , 13177: 'Q409803' , 13178: 'Q409803' , 1318: 'Q2482759' , 1319: 'Q3039376' , 13195: 'Q191222' , 13196: 'Q191222' , 1320: 'Q3715339' , 13201: 'Q422339' , 13202: 'Q422339' , 13203: 'Q422857' , 13204: 'Q422857' , 13207: 'Q338119' , 13209: 'Q425142' , 1321: 'Q3715525' , 13210: 'Q425142' , 13213: 'Q409122' , 13214: 'Q2150822' , 13215: 'Q2150822' , 1322: 'Q3715593' , 13221: 'Q1057606' , 13228: 'Q1057733' , 13237: 'Q617097' , 1324: 'Q422333' , 13246: 'Q111044' , 13248: 'Q727306' , 1325: 'Q409433' , 13250: 'Q3665704' , 13258: 'Q278106' , 1326: 'Q3716119' , 13268: 'Q420478' , 13269: 'Q420478' , 13270: 'Q3666204' , 13274: 'Q420180' , 13275: 'Q420180' , 13276: 'Q1118625' , 13278: 'Q422167' , 1328: 'Q3716229' , 13280: 'Q3666837' , 13282: 'Q3666867' , 13283: 'Q3666867' , 1329: 'Q677619' , 1330: 'Q126204' , 13312: 'Q3667211' , 1332: 'Q3041518' , 13320: 'Q3667272' , 13497: 'Q419137' , 13498: 'Q2293541' , 13499: 'Q2293541' , 1350: 'Q3719013' , 13502: 'Q416294' , 13503: 'Q416294' , 13506: 'Q899841' , 13507: 'Q899841' , 13508: 'Q1112922' , 1352: 'Q3719076' , 13520: 'Q421037' , 13521: 'Q421037' , 13522: 'Q417473' , 13523: 'Q417473' , 13528: 'Q1059093' , 13529: 'Q1059093' , 13531: 'Q651700' , 13534: 'Q414816' , 13535: 'Q414816' , 13538: 'Q410336' , 13539: 'Q410336' , 1354: 'Q3719719' , 13544: 'Q1065048' , 13545: 'Q1065048' , 13548: 'Q3693975' , 13549: 'Q3693975' , 1355: 'Q3720264' , 13556: 'Q1135968' , 1356: 'Q3720326' , 13560: 'Q425639' , 13561: 'Q425639' , 13566: 'Q325345' , 1357: 'Q3720472' , 13572: 'Q429813' , 13574: 'Q3696717' , 1358: 'Q3720608' , 13580: 'Q382754' , 13581: 'Q382754' , 13588: 'Q3697144' , 1359: 'Q3720626' , 13590: 'Q422075' , 13591: 'Q422075' , 13594: 'Q422903' , 13595: 'Q422903' , 13596: 'Q2706053' , 13597: 'Q2706053' , 13598: 'Q430083' , 13599: 'Q430083' , 1361: 'Q2252707' , 13614: 'Q424923' , 13615: 'Q424923' , 13616: 'Q418873' , 13617: 'Q418873' , 13618: 'Q430065' , 1362: 'Q3720811' , 13620: 'Q407335' , 13621: 'Q407335' , 1363: 'Q3718487' , 1364: 'Q1920794' , 1366: 'Q3723499' , 13664: 'Q1144552' , 13667: 'Q416942' , 13676: 'Q421020' , 1368: 'Q3723545' , 13684: 'Q424094' , 13686: 'Q3667124' , 13688: 'Q339530' , 1369: 'Q1301508' , 13693: 'Q3700777' , 1375: 'Q43513' , 1375: 'Q43513' , 1380: 'Q411881' , 13832: 'Q3712204' , 1389: 'Q272844' , 1407: 'Q247914' , 1414: 'Q420287' , 14148: 'Q417387' , 14149: 'Q417387' , 1415: 'Q3734119' , 1417: 'Q2632186' , 14170: 'Q2250996' , 1419: 'Q1077131' , 142: 'Q2629082' , 1420: 'Q419270' , 14204: 'Q3743232' , 1421: 'Q1372252' , 14212: 'Q3743238' , 14222: 'Q1407970' , 1423: 'Q3734472' , 1424: 'Q3734518' , 1425: 'Q1146596' , 14250: 'Q1408085' , 14252: 'Q3743842' , 14256: 'Q3743850' , 14257: 'Q3743850' , 1426: 'Q415880' , 14262: 'Q413639' , 14263: 'Q413639' , 14266: 'Q3744517' , 14268: 'Q1057224' , 14269: 'Q1057224' , 1427: 'Q3735298' , 14270: 'Q3745378' , 14271: 'Q3745378' , 1428: 'Q13536972' , 14282: 'Q1119933' , 14286: 'Q3746564' , 1429: 'Q3735754' , 14292: 'Q3755484' , 14294: 'Q3746703' , 14295: 'Q3746703' , 14299: 'Q428379' , 14306: 'Q416275' , 14307: 'Q416275' , 1431: 'Q3736318' , 14310: 'Q3746844' , 14311: 'Q3746844' , 1432: 'Q3736442' , 14321: 'Q1065167' , 14323: 'Q415037' , 1433: 'Q3737571' , 14332: 'Q2252335' , 14339: 'Q417443' , 14345: 'Q3490672' , 14349: 'Q418094' , 1435: 'Q3738375' , 14350: 'Q418094' , 1436: 'Q1112021' , 14363: 'Q2249248' , 14364: 'Q2249248' , 14365: 'Q410810' , 14366: 'Q410810' , 14369: 'Q3753125' , 14375: 'Q1469279' , 14381: 'Q3753635' , 14383: 'Q1470345' , 1439: 'Q3738431' , 14393: 'Q3754133' , 14405: 'Q3757195' , 14407: 'Q375357' , 14408: 'Q375357' , 14419: 'Q414877' , 1442: 'Q3738438' , 14420: 'Q414877' , 14423: 'Q424112' , 14424: 'Q424112' , 14425: 'Q3045746' , 14426: 'Q3045746' , 14427: 'Q411230' , 14428: 'Q411230' , 1443: 'Q3738453' , 14443: 'Q45163524' , 14445: 'Q3758444' , 14449: 'Q412947' , 14455: 'Q3099383' , 14459: 'Q420793' , 1446: 'Q3738647' , 14460: 'Q420793' , 1473: 'Q3742061' , 14731: 'Q1065515' , 14732: 'Q1065515' , 14738: 'Q677580' , 1475: 'Q3742405' , 14757: 'Q3783667' , 1476: 'Q417387' , 14762: 'Q420316' , 14763: 'Q383713' , 14764: 'Q383713' , 14765: 'Q411830' , 14766: 'Q411830' , 14769: 'Q430074' , 1477: 'Q1405017' , 14776: 'Q2249072' , 14779: 'Q3129310' , 1478: 'Q19963556' , 14782: 'Q422984' , 1479: 'Q3742785' , 14791: 'Q429570' , 14792: 'Q429570' , 14798: 'Q3784699' , 14799: 'Q3784724' , 1480: 'Q3742784' , 14804: 'Q103223' , 14809: 'Q3784779' , 14811: 'Q408008' , 14815: 'Q422318' , 1482: 'Q3809694' , 14823: 'Q3130295' , 14827: 'Q3784895' , 14835: 'Q377086' , 1484: 'Q3743001' , 14845: 'Q418863' , 14846: 'Q418863' , 1485: 'Q3743140' , 14850: 'Q3785368' , 14857: 'Q408196' , 14858: 'Q408196' , 14861: 'Q1466985' , 14862: 'Q1466985' , 14865: 'Q1616655' , 14875: 'Q3785452' , 14881: 'Q3785465' , 14888: 'Q3785626' , 1490: 'Q3743175' , 1493: 'Q2250996' , 1495: 'Q3743190' , 1496: 'Q2424058' , 1497: 'Q3743191' , 1498: 'Q3743193' , 1499: 'Q3743194' , 1500: 'Q3743195' , 15000: 'Q2738366' , 1501: 'Q3743197' , 15626: 'Q3826891' , 15720: 'Q3830198' , 1576: 'Q102151' , 1610: 'Q3753266' , 162: 'Q420958' , 1641: 'Q37559' , 16429: 'Q3322601' , 16646: 'Q3874703' , 16751: 'Q3879321' , 16754: 'Q3879976' , 1683: 'Q415856' , 1710: 'Q423034' , 1719: 'Q189703' , 18: 'Q104692' , 1804: 'Q5314' , 1809: 'Q417278' , 18169: 'Q3973238' , 1831: 'Q420316' , 18366: 'Q3980304' , 1856: 'Q103223' , 18588: 'Q3995714' , 19253: 'Q4023579' , 1992: 'Q413478' , 2: 'Q2294982' , 2013: 'Q190729' , 2072: 'Q415818' , 210: 'Q239589' , 2156: 'Q223197' , 2187: 'Q420537' , 21965: 'Q3941515' , 2303: 'Q193450' , 2321: 'Q3826891' , 234: 'Q105439' , 239: 'Q120481' , 240: 'Q414149' , 25274: 'Q3980907' , 26094: 'Q4021124' , 262: 'Q1099' , 268: 'Q417254' , 27424: 'Q3816088' , 2763: 'Q3322601' , 2815: 'Q106532' , 2879: 'Q3874703' , 2945: 'Q3879976' , 3021: 'Q419183' , 307: 'Q23775' , 31211: 'Q3816088' , 31570: 'Q182344' , 3337: 'Q43010' , 36766: 'Q682' , 3782: 'Q421831' , 4000: 'Q3995714' , 40179: 'Q19833676' , 40570: 'Q412784' , 4070: 'Q1934730' , 4159: 'Q3189938' , 422: 'Q410369' , 4433: 'Q230181' , 447: 'Q108212' , 4509: 'Q143447' , 4788: 'Q942' , 48: 'Q1070595' , 53294: 'Q60621049' , 549: 'Q184196' , 628: 'Q2251934' , 727: 'Q108694' , 738: 'Q250618' , 741: 'Q413314' , 787: 'Q410609' , 790: 'Q2896415' , 791: 'Q3645538' , 793: 'Q2251961' , 794: 'Q3646279' , 795: 'Q3646300' , 796: 'Q1070902' , 797: 'Q3646769' , 800: 'Q13114' , 801: 'Q1009724' , 803: 'Q3647236' , 806: 'Q3647435' , 808: 'Q3647463' , 810: 'Q1113496' , 811: 'Q3647740' , 813: 'Q4101132' , 814: 'Q570184' , 817: 'Q3638277' , 818: 'Q2235148' , 820: 'Q419250' , 8212: 'Q3817441' , 831: 'Q3650481' , 832: 'Q3650477' , 834: 'Q3650486' , 8380: 'Q25381' , 849: 'Q3649567' , 850: 'Q3649572' , 851: 'Q3649812' , 852: 'Q414999' , 854: 'Q3650236' , 855: 'Q3650468' , 856: 'Q3650470' , 859: 'Q171917' , 860: 'Q3650476' , 861: 'Q3650488' , 862: 'Q959680' , 863: 'Q3650522' , 864: 'Q429522' , 865: 'Q383624' , 867: 'Q3650789' , 868: 'Q3650824' , 869: 'Q4517638' , 871: 'Q3651093' , 872: 'Q657684' , 8738: 'Q2843949' , 874: 'Q3651367' , 877: 'Q3655104' , 878: 'Q3655118' , 879: 'Q3655127' , 880: 'Q417444' , 881: 'Q3655162' , 882: 'Q3655328' , 883: 'Q3655422' , 8864: 'Q3787382' , 889: 'Q3657310' , 89: 'Q420563' , 890: 'Q3658165' , 891: 'Q3658269' , 892: 'Q3658270' , 893: 'Q3658275' , 894: 'Q3658291' , 898: 'Q1070792' , 90: 'Q143447' , 900: 'Q3658900' , 902: 'Q3660153' , 9020: 'Q417421' , 903: 'Q3660152' , 904: 'Q5042890' , 905: 'Q3660390' , 906: 'Q409781' , 907: 'Q409100' , 908: 'Q409803' , 9081: 'Q156526' , 909: 'Q3660669' , 910: 'Q3660707' , 911: 'Q1058717' , 914: 'Q3661527' , 916: 'Q3661996' , 917: 'Q191222' , 920: 'Q422339' , 921: 'Q422857' , 922: 'Q3664035' , 923: 'Q3664060' , 924: 'Q3664062' , 925: 'Q338119' , 926: 'Q425142' , 9263: 'Q1143781' , 927: 'Q407221' , 928: 'Q429534' , 929: 'Q3665101' , 9294: 'Q3704572' , 9333: 'Q324369' , 934: 'Q409122' , 935: 'Q3665221' , 936: 'Q2150822' , 939: 'Q1057606' , 94: 'Q1070610' , 941: 'Q3665625' , 943: 'Q1057733' , 945: 'Q3650518' , 946: 'Q3675291' , 948: 'Q48772418' , 954: 'Q3665757' , 955: 'Q111044' , 956: 'Q727306' , 957: 'Q3665704' , 958: 'Q3665738' , 959: 'Q407861' , 96: 'Q182264' , 960: 'Q170448' , 961: 'Q3650494' , 962: 'Q278106' , 965: 'Q3666093' , 966: 'Q3666057' , 967: 'Q420478' , 968: 'Q3666204' , 969: 'Q3666242' , 970: 'Q420180' , 971: 'Q1118625' , 972: 'Q422167' , 973: 'Q3666837' , 974: 'Q3666867' , 978: 'Q3665758' , 979: 'Q420293' , 9796: 'Q6817061' , 982: 'Q3675294' , 985: 'Q3667036' , 987: 'Q3667129' , 989: 'Q3667191' , 991: 'Q3667211' , 992: 'Q3667215' , 993: 'Q3667216' , 995: 'Q2962810' , 996: 'Q3667267' , 997: 'Q3667272' , 998: 'Q3667273' }
for mindat_key in hiztegi_wdata:
site = pywikibot.Site('eu', 'wikipedia') # any site will work, this is just an example
repo = site.data_repository() # this is a DataSite object
wdata_ID = hiztegi_wdata.get(mindat_key,'!!!!')
item = pywikibot.ItemPage(repo, wdata_ID)
item.get() # you need to call it to access any data.
sitelinks = item.sitelinks
print sitelinks
if 'euwiki' in sitelinks:
print('The article in Basque is: ' + sitelinks['euwiki'])
else:
#print('There is no article in Basque')
Mindat_url = 'min-'+str(mindat_key)+'.html'
informe2=irakurriminerala(Mindat_url)
informe2=unialerroa(informe2)
if 'cawiki' in sitelinks:
EU_labela = sitelinks['cawiki'] # Artikuluaren izenburua katalenezkoa bera izango da.
elif 'enwiki' in sitelinks:
EU_labela = sitelinks['enwiki'] # Artikuluaren izenburua ingelesez bera izango da.
elif len(sitelinks.keys()) > 0:
EU_labela = sitelinks[sitelinks.keys()[0]] # Artikuluaren izenburua wikidatko kontzeptua duen beste edozein hizkuntzan.
else:
labels = item.labels
EU_labela = sitelinks[sitelinks.keys()[0]] # Artikuluaren izenburua wikidatko kontzeptua duen beste edozein hizkuntzan.
desti=pywikibot.Page(site,EU_labela)
desti.put(informe2,u"Automatikoki sortua mindat.org webguneko datuekin")
item.setSitelink(sitelink={'site': 'euwiki', 'title': EU_labela}, summary=u'Set sitelink in Basque')
if 'eu' in item.labels:
print('The label in Basque is: ' + item.labels['eu'])
else:
print('There is no label in Basque')
item.editLabels(labels={'eu': EU_labela }, summary=u'Edit label')
item.editDescriptions(descriptions={'eu': 'mineral'}, summary=u'Edit description')
#================================================================================
# Programa hemen hasten da.
#informe=""
##Alfabetoaren letra bakoitzeko orrialdea aztertu
#for letra in list(string.ascii_uppercase):
# print letra+' aztertzen ari naiz'
# informe=""
# informe=informe+tratatuorria(letra)
# print("informe:",len(informe))
# informe=unialerroa(informe)
# #Euskal wikipedian, adierazten den proba orrian Wikipediako zirriborroa sortzen da, letra bakoitzarentzat orri desberdina izango da.
# site=pywikibot.Site('eu')
# desti=pywikibot.Page(site,u"Lankide:EUmineralbot/Proba-"+letra)
# desti.put(informe,u"Infotaulas de minerales con datos de mindat.org")
pywikibot.stopme()