Jump to content

英文维基 | 中文维基 | 日文维基 | 草榴社区

User:Ramaksoud2000Bot/ShadowsCommons source

From Wikipedia, the free encyclopedia

This relies on this file by MER-C, and only includes the code for this task.

Wiki wiki;
wiki = new Wiki("en-two.iwiki.icu"); // create a new wiki connection to en-two.iwiki.icu
try{
    BufferedReader fileIn = new BufferedReader(new FileReader("quarry.csv")); 
    String line = fileIn.readLine();
    line=fileIn.readLine();
    while (line!=null)
    {
        enwikifiles.add("File:" + line); //build ArrayList of enwiki titles
        line=fileIn.readLine();
    }
    System.out.println(enwikifiles.toString()); //print array
}
catch (IOException ex)
{
    System.out.println(ex);
}
try
{
    wiki.setAssertionMode(1);
    for (String page : enwikifiles)
    {
       String wikiText=wiki.getPageText(page);
       if (wikiText==null)
       {
            //do nothing
       }
       else if (allowBots(wikiText, "Ramaksoud2000Bot")==false) //exclusion compliance
       {
            //do nothing
       }
       else
       {
            wiki.prepend(page, "{{ShadowsCommons}}", "Different file with the same name exists on Commons. Adding {{ShadowsCommons}}.", false, true);
       }
      }
}
      
 catch (LoginException ex)
{
    System.out.println(ex);
}  
catch (IOException ex)
{
    System.out.println(ex);
}