אונטערשייד צווישן ווערסיעס פון "באַניצער:בוט צמא לדעת/descriptions.js"

אנדערע שפראכן..
אין תקציר עריכה
(אנדערע שפראכן..)
שורה 8: שורה 8:
             "utf8": 1,
             "utf8": 1,
             "apnamespace": "8000",
             "apnamespace": "8000",
             "apfilterredir": "redirects",
             "apfilterredir": "nonredirects",
             "apfrom": "מורה הנבוכים",
             //"apfrom": "שמן",
             "aplimit": "500"
             "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);
                console.log('last was: ', pageName);
                 }
                 }
             }
             }
שורה 29: שורה 29:


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


                                var api = new mw.Api();
                            var api = new mw.Api();
                                api.get(params).done(function (data) {
                            api.get(params).done(function (data) {
                                    for (const p in data.query.pages) {
                                for (const p in data.query.pages) {
                                        console.log(data.query.pages[p]);
                                    console.log(data.query.pages[p]);
                                        if (!("categories" in data.query.pages[p])) {
                                    if (!("categories" in data.query.pages[p])) {
                                            addDesc(target, description);
                                        addDesc(pageName, descriptions);
                                        }
                                     }
                                     }
                                 })
                                 }
                            })


                            }
                        }
                        });
                    });
                    }
                 }
                 });
            });
        });
     }
     }






     function addDesc(pageName, text) {
     function addDesc(pageName, descriptions) {
    var text;
    if ('en' in descriptions) {
    text += 'ענגליש=' + descriptions.en.value + '|';
    }
    if ('he' in descriptions) {
    text += 'העב=' + descriptions.he.value + '|';
    }
    if ('de' in descriptions) {
    text += 'דייטש=' + descriptions.de.value + '|';
    }
         var params = {
         var params = {
             "action": "edit",
             "action": "edit",
             "format": "json",
             "format": "json",
             "title": pageName,
             "title": pageName,
             "summary": "דעסקריפציע: " + text,
             "summary": "דעסקריפציע",
             "minor": 1,
             "minor": 1,
             "bot": 1,
             "bot": 1,
             "prependtext": '{{דעסקריפציע|' + text + '}}\n',
             "prependtext": '{{דעסקריפציע||' + text + '}}\n',
             "appendtext": '\n[' + '[קאַטעגאָריע:וויקידאטא דעסקריפציע]]',
             //"appendtext": '\n[' + '[קאַטעגאָריע:וויקידאטא דעסקריפציע]]',
             "utf8": 1
             "utf8": 1
         },
         },
35,369

רעדאגירונגען