35,369
רעדאגירונגען
אין תקציר עריכה |
אין תקציר עריכה |
||
| שורה 8: | שורה 8: | ||
"utf8": 1, | "utf8": 1, | ||
"apnamespace": "8000", | "apnamespace": "8000", | ||
"apfilterredir": " | "apfilterredir": "redirects", | ||
"apfrom": "שמן", | //"apfrom": "שמן", | ||
"aplimit": " | "aplimit": "10" | ||
}).done((data) => { | }).done((data) => { | ||
//console.table(data); | //console.table(data); | ||
| שורה 22: | שורה 22: | ||
sum++; | sum++; | ||
if (sum >= 499) { | if (sum >= 499) { | ||
console.log('last was: ', pageName); | |||
} | } | ||
} | } | ||
| שורה 29: | שורה 29: | ||
function wikidataDesc(page) { | function wikidataDesc(page) { | ||
const | const redirect = page//.replace('איד', 'ייד')//.replace(/^רבי /, "").replace(/^הרב /, "").replace(/\"הייליגע\"/g, "הייליגע").replace('דעיוויד', 'דייוויד'); | ||
$.ajax({ | const api = new mw.Api(); | ||
api.get({ | |||
"action": "query", | |||
"format": "json", | |||
"utf8": 1, | |||
"titles": redirect, | |||
"redirects": true | |||
}).done((info) => { | |||
const target = info.query.redirects[0].to; | |||
$.ajax({ | |||
url: '//www.wikidata.org/w/api.php', | |||
data: { | |||
'format': 'json', | |||
'action': 'wbgetentities', | |||
'sites': "yiwiki", | |||
'titles': redirect, | |||
'props': 'descriptions', | |||
'languages': 'yi' | |||
}, | |||
dataType: 'jsonp', | |||
cache: true | |||
}) | |||
.done(function (data) { | |||
console.log(data); | |||
if (data.success) { | |||
//console.table(data.success); | |||
$(function () { | |||
for (var e in data.entities) { | |||
if (e == -1) return; | |||
var descriptions = data.entities[e].descriptions; | |||
if (!descriptions.yi) return console.log('ל' + pageName + ' אין מידע ויקינתונים.'); | |||
const description = descriptions.yi.value; | |||
//console.table(e); | |||
console.log(redirect + ' (' + target + '): ' + description); | |||
console.timeLog('מדידת זמן', '2'); | |||
var params = { | |||
"action": "query", | |||
"format": "json", | |||
"titles": target, | |||
"prop": "categories", | |||
"clcategories": "קאַטעגאָריע:בלעטער מיט קורצע דעסקריפציע" | |||
} | |||
var api = new mw.Api(); | |||
api.get(params).done(function (data) { | |||
for (const p in data.query.pages) { | |||
console.log(data.query.pages[p]); | |||
if (!("categories" in data.query.pages[p])) { | |||
addDesc(target, description); | |||
} | |||
} | } | ||
}) | |||
} | } | ||
} | }); | ||
} | } | ||
}); | |||
}); | |||
} | } | ||