本文整理汇总了Java中org.wikipedia.Wiki.setThrottle方法的典型用法代码示例。如果您正苦于以下问题:Java Wiki.setThrottle方法的具体用法?Java Wiki.setThrottle怎么用?Java Wiki.setThrottle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wikipedia.Wiki
的用法示例。
在下文中一共展示了Wiki.setThrottle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: guiLogin
import org.wikipedia.Wiki; //导入方法依赖的package包/类
public static void guiLogin(Wiki wiki) {
JTextField u = new JTextField(12);
JPasswordField px = new JPasswordField(12);
do {
JPanel pl = FbotUtil.buildForm("Login",
new JLabel("Username:", 11), u,
new JLabel("Password:", 11), px);
if (JOptionPane.showConfirmDialog(null, pl, "Login", 2, -1) != 0) {
System.exit(0);
}
} while (!Fbot.loginAndSetPrefs(wiki, u.getText().trim(),
px.getPassword()));
wiki.setThrottle(5);
}
示例2: main
import org.wikipedia.Wiki; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
// login
Wiki wiki = Wiki.createInstance("test.wikipedia.org");
LoginUtils.guiLogin(wiki);
wiki.setThrottle(5);
/*
// raw watchlist
for (String page : wiki.getRawWatchlist())
System.out.println(page);
// file move
wiki.move("File:Test12345.png", "File:Test123456.png", "test12345", true, false, false);
wiki.move("File:Test123456.png", "File:Test12345.png", "test123456", true, false, false);
// email
//wiki.emailUser(wiki.getCurrentUser(), "Testing", "Blah", false);
// watch
wiki.watch("Main Page", "Blah");
wiki.unwatch("Main Page", "Blah");
// watchlist
for (Wiki.Revision item : wiki.watchlist(false))
System.out.println(item);
// upload
wiki.upload(new File("~/Pictures/marsface.jpg"), "Wiki.java test4.jpg", "Test image. Source: [[:File:Face on Mars with Inset.jpg]]. ∑∑ƒ∂ß", "hello ∑∑ƒ∂ß");
///////////////////////
// ADMIN STUFF
///////////////////////
// deleted revisions
for (Wiki.Revision rev : wiki.getDeletedHistory("User:MER-C/UnitTests/Delete"))
System.out.println(rev);
// deleted prefix index
for (String page : wiki.deletedPrefixIndex("B", Wiki.MAIN_NAMESPACE))
System.out.println(page);
// logout
wiki.logout();
// TODO: move the following to testwiki
// Wiki enWiki = Wiki.createInstance("en.wikipedia.org");
// LoginUtils.guiLogin(enWiki);
// enWiki.setThrottle(5);
// deleted contributions
// for (Wiki.Revision rev : enWiki.deletedContribs("Namkeenvilla"))
// System.out.println(rev);
// revdeled information
// Calendar start = new GregorianCalendar(2014, 1, 22);
// Calendar end = new GregorianCalendar(2014, 1, 24);
// for (Wiki.Revision rev : enWiki.getPageHistory("Imran Khan (singer)", start, end, false))
// System.out.println(rev);
// revdelete
// Wiki.Revision rev = enWiki.getRevision(600296466L);
// enWiki.revisionDelete(Boolean.TRUE, null, Boolean.TRUE, "Testing", Boolean.TRUE, new Wiki.Revision[] { rev });
// enWiki.revisionDelete(Boolean.FALSE, null, null, "Testing", Boolean.FALSE, new Wiki.Revision[] { rev });
// enWiki.revisionDelete(null, null, Boolean.FALSE, "Testing", Boolean.FALSE, new Wiki.Revision[] { rev });
*/
}