public abstract class DianXinForSpiderTest extends DianXinTest { protected Spider spider = SpiderManager.getInstance().createSpider("test", "aaa"); protected AbstractDianXinCrawler dx = null; public void test() { initData(); execute(); if (dx.isSuccess()) { assuranceData( user != null ? user : dx.getUser(), dx.getTelList(), dx.getDetailList(), dx.getMessageList()); } // assuranceData(dx.getUser(), dx.getTelList(), dx.getDetailList(), dx.getMessageList()); } protected void useProxy() { ProxyPool.initProxyPool(); ProxyPool pp = ProxyPool.getProxyPool(); pp.addProxy(new String[] {"139.217.4.210", "31288"}); spider.setUseProxy(true); } }
public static void main(String[] args) throws Exception { /* * for(int i=0; i< 10; i++) { System.out.println(i + "=" + (int) * (Math.random() * 1000 % 10)); } if (true) { return; } */ ShangHaiDianXin dx1 = new ShangHaiDianXin(); dx1.requestService(); boolean isTestSms = false; String phoneNo = "18016252553"; String password = "******"; String imgCode = null; Spider spider = SpiderManager.getInstance().createSpider("test", "aaa"); ShangHaiDianXin dx = new ShangHaiDianXin(spider, null, phoneNo, password, "2345", null); dx.setTest(true); // DebugUtil.addToCookieStore("www.189.cn", // "JSESSIONID=F963B038D5489C15A308A64DBF9B89EC-n14;"); // DebugUtil.addToCookieStore("uam.ct10000.com", // "JSESSIONID=0000NEi1uFD2wq0Uo1-ZYYb6e8_:18m6j7te1;"); if (!isTestSms) { dx.checkVerifyCode(phoneNo); spider.start(); dx.printData(); imgCode = CUtil.inputYanzhengma(); dx.setAuthCode(imgCode); dx.getData().clear(); /* * CookieStore cs = CookieStoreUtil.putContextToCookieStore(null, * 1); DebugUtil.printCookieData(cs, "www.189.cn"); * DebugUtil.printCookieData(cs, "uam.ct10000.com"); */ dx.goLoginReq(); spider.start(); dx.parseBalanceInfo(); spider.start(); // DebugUtil.findMissing(cs, // CookieStoreUtil.putContextToCookieStore(null, 1)); } else { DebugUtil.addToCookieStore( "sh.189.cn", ".ybtj.189.cn=590566E9B59ACF4CAED1A5D93A77C015;JSESSIONID=0000aBuIqoAkvVpCNMr0hbctakn:14horgrp7;JSESSIONID=000150uiRh29ZJYvZdV295TKBfy:-K00E9;NSC_xu-222.68.185.229=ffffffffc3a01f1645525d5f4f58455e445a4a423660;SSLJSESSION=0001SESSIONMANAGEMENTAFFINI:-GK5AF7;UAMTGC=TGT-137611-jNhbnSnCtbuL9IuJZg3hajXgqTygNY6gHblaN6Smn31BSFEriy-uam;citrix_ns_id=hDpt4EK0T/54cf3R2kdRUptXoqUA000;citrix_ns_id_.189.cn_%2F_wat=SlNFU1NJT05JRF9f?GJVU755YShTDws6Vq+cPIy2rUIsA#qbg2R/Rp9UAoyjTa8a72ZkzKpoIA&;citrix_ns_id_.189.cn_%2F_wlf=TlNDX3h1LTIyMi42OC4xODUuMjI5?yag49zJ2NzBf26sVRUcSiIKLM+kA&;cityCode=sh;isLogin=logined;userId=201|151669205;"); dx.parseBalanceInfo(); spider.start(); } if (isTestSms) { // dx.parseBalanceInfo(); } // dx.getUser() 个人信息 // dx.getDetailList() 详单 // dx.getTelList() 帐单 if (isTestSms || dx.isSuccess()) { dx.showImgWhenSendSMS(phoneNo); spider.start(); imgCode = CUtil.inputYanzhengma(); dx.sendSmsPasswordForRequireCallLogService(imgCode); spider.start(); if (dx.isSuccess()) { String smsCode = CUtil.inputYanzhengma(); dx.requestAllService(smsCode, imgCode); spider.start(); } } dx.printData(); }