#coding=utf-8 __author__ = 'shifeixiang' import time from selenium import webdriver from bs4 import BeautifulSoup from append_predict.models import KillPredict from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.predict_append_rule_100').log() #获取predict driver def spider_predict_selenium(): driver_flag = True while (driver_flag): driver = webdriver.Firefox( executable_path='./pkten_log/geckodriver.exe') driver.get("https://www.1399p.com/pk10/shdd") try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located( (By.CLASS_NAME, "lotteryNumber"))) driver_flag = False return driver
#coding=utf-8 __author__ = 'shifeixiang' # from __future__ import unicode_literals from selenium import webdriver import time from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_hf.purchase_driver').log() def get_driver(username, password): chromedriver = "./pkten_log/chromedriver37.exe" options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"]) driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=options) # driver = webdriver.Firefox(executable_path = 'E:\\python\\webdriver\\firefox\\geckodriver.exe') # driver.get("http://92.hf666.net/login_page.jsp?p=QWERTYUNjI0MTc1OTM1MT14ZWRuaV84ODhmciZuYz1YR05BTCY4ODhmcj1scHQmPWhy") driver.get( "http://96.m1888.net/login_page.jsp?p=QWERTYUMjA4NDcxMDQ1MT14ZWRuaV84NjFvcyZuYz1YR05BTCY4NjFvcz1scHQmPWhy" ) # driver.find_element_by_class_name() # driver.get("http://pxiagme1.lot1068.net/member/fouvrh5q0rhl2edlk9m7jong3e/Welcome.action") driver.maximize_window() time.sleep(5)
#coding=utf-8 __author__ = 'shifeixiang' import time import threading import datetime import append_purchase_dianyou.purchase_client_main from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_dianyou.client_thread').log() class Spider(threading.Thread): # __metaclass__ = Singleton thread_stop = False thread_num = 0 interval = {} behavior = None def run(self): self.behavior(self, self.thread_num, self.interval) def stop(self): self.thread_stop = True class ThreadControl(): thread_stop = False current_thread = {}
#coding=utf-8 __author__ = 'shifeixiang' import time import threading import datetime # from predict.main import spider_save_predict import append_predict.main from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.thread').log() class Spider(threading.Thread): # __metaclass__ = Singleton thread_stop = False thread_num = 0 interval = {} behavior = None def run(self): self.behavior(self, self.thread_num, self.interval) def stop(self): self.thread_stop = True class ThreadControl(): thread_stop = False current_thread = {}
#coding=utf-8 __author__ = 'shifeixiang' import time import threading import datetime import append_purchase_hf.purchase_client_main from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_hf.client_thread').log() class Spider(threading.Thread): # __metaclass__ = Singleton thread_stop = False thread_num = 0 interval = {} behavior = None def run(self): self.behavior(self, self.thread_num, self.interval) def stop(self): self.thread_stop = True class ThreadControl(): thread_stop = False current_thread = {}
#coding=utf-8 __author__ = 'shifeixiang' from selenium import webdriver import time from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_dianyou.purchase_driver').log() def get_driver(username, password): #谷歌浏览器 # chromedriver = "E:\\python\\webdriver\\chrome\\chromedriver37.exe" # options = webdriver.ChromeOptions() # options.add_experimental_option("excludeSwitches",["ignore-certificate-errors"]) # driver = webdriver.Chrome(executable_path=chromedriver,chrome_options=options ) #火狐浏览器 driver = webdriver.Firefox( executable_path='E:\\python\\webdriver\\firefox\\geckodriver.exe') driver.get( 'http://pxkagme1.lot1068.net:8082/member/Welcome.action?searchKeyword=33588' ) driver.maximize_window() user_elem = driver.find_element_by_name("userCode") user_elem.send_keys(username) code_flag = True while (code_flag): try: pwd_elem = driver.find_element_by_name("password")
#coding=utf-8 __author__ = 'shifeixiang' import time import threading import datetime import append_purchase_baodao_sandd.purchase_client_main from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_baodao_sandd.client_thread').log() class Spider(threading.Thread): # __metaclass__ = Singleton thread_stop = False thread_num = 0 interval = {} behavior = None def run(self): self.behavior(self, self.thread_num, self.interval) def stop(self): self.thread_stop = True class ThreadControl(): thread_stop = False current_thread = {}
#coding=utf-8 __author__ = 'shifeixiang' import time from selenium import webdriver from bs4 import BeautifulSoup from append_predict.models import KillPredict from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.predict_driver').log() #获取predict driver def spider_predict_selenium(): chromedriver = "E:\\python\\webdriver\\chrome\\chromedriver37.exe" options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"]) driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=options) driver.get("https://www.1399p.com/pk10/shdd") return driver #获取10个名次的soup 列表 def get_soup_list(driver): soup_list = [] count = 0 flag = True
#最小命中率 号码是6个 四期未中跳转 #from append_predict.predict_append_rule_100_jump_continue4_base_min_6zhu import spider_predict_selenium,get_purchase_list from append_predict.predict_append_rule_100_jump_continue5_one_hit_percent_low import spider_predict_selenium,get_purchase_list #固定号码 # from append_predict.predict_append_rule_fixed import spider_predict_selenium,get_purchase_list from append_predict.spider_pk10 import get_html_result,get_lottery_id_number,load_lottery_predict import time import datetime from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.main').log() class Singleton(object): def __new__(cls, *args, **kw): if not hasattr(cls, '_instance'): orig = super(Singleton, cls) cls._instance = orig.__new__(cls, *args, **kw) return cls._instance class SingleDriver(Singleton): # def __init__(self, driver): # self.driver = driver def get_driver(self): return self.driver def set_driver(self, driver): self.driver = driver
from django.views.decorators.csrf import csrf_exempt #用于处理post请求出现的错误 from django.shortcuts import render_to_response from append_predict_sandd.models import ProbUser from append_predict_sandd.models import KillPredict, PredictLottery from append_predict_sandd.thread import ThreadControl from append_predict_sandd.predict_append_rule import spider_predict_selenium, get_purchase_list_sandd from append_predict_sandd.spider_pk10 import get_html_result, get_lottery_id_number, load_lottery_predict import time import datetime import math from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict_sandd.main').log() class Singleton(object): def __new__(cls, *args, **kw): if not hasattr(cls, '_instance'): orig = super(Singleton, cls) cls._instance = orig.__new__(cls, *args, **kw) return cls._instance class SingleDriver(Singleton): # def __init__(self, driver): # self.driver = driver def get_driver(self): return self.driver
#coding=utf-8 __author__ = 'shifeixiang' import time from selenium import webdriver from bs4 import BeautifulSoup from append_predict.models import KillPredict from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.predict_append_rule_fixed').log() #获取predict driver def spider_predict_selenium(): driver_flag = True while (driver_flag): driver = webdriver.Firefox( executable_path='./pkten_log/geckodriver.exe') driver.get("https://www.1399p.com/pk10/shdd") try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located( (By.CLASS_NAME, "lotteryNumber"))) driver_flag = False
#coding=utf-8 __author__ = 'shifeixiang' # from __future__ import unicode_literals from selenium import webdriver import time from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_lide_sand.purchase_driver').log() def get_driver(username,password): # chromedriver = "E:\\python\\webdriver\\chrome\\chromedriver37.exe" # options = webdriver.ChromeOptions() # options.add_experimental_option("excludeSwitches",["ignore-certificate-errors"]) # driver = webdriver.Chrome(executable_path=chromedriver,chrome_options=options ) driver = webdriver.Firefox(executable_path = 'E:\\python\\webdriver\\firefox\\geckodriver.exe') driver.get("http://mem5.tfnvhg606.lexinsoft.com/") # driver.find_element_by_class_name() # driver.get("http://pxiagme1.lot1068.net/member/fouvrh5q0rhl2edlk9m7jong3e/Welcome.action") driver.maximize_window(); time.sleep(2) #user_elem = driver.find_element_by_name("account") user_elem = driver.find_element_by_id("loginName") # user_elem.send_keys("abab2233") user_elem.send_keys(username)
#coding=utf-8 __author__ = 'shifeixiang' from selenium import webdriver import time from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_jinsha.purchase_driver').log() #'//*[@id="username"]' def get_driver(username, password): #谷歌浏览器 # chromedriver = "E:\\python\\webdriver\\chrome\\chromedriver37.exe" # options = webdriver.ChromeOptions() # options.add_experimental_option("excludeSwitches",["ignore-certificate-errors"]) # driver = webdriver.Chrome(executable_path=chromedriver,chrome_options=options ) #火狐浏览器 driver = webdriver.Firefox( executable_path='E:\\python\\webdriver\\firefox\\geckodriver.exe') driver.get('http://www.ag888xjs.net/Common/Index/login.html') driver.maximize_window() user_elem = driver.find_element_by_name("username") user_elem.send_keys(username) code_flag = True while (code_flag): if 1:
#coding=utf-8 __author__ = 'shifeixiang' import time from selenium import webdriver from bs4 import BeautifulSoup from append_predict_sandd.models import KillPredict from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from append_predict_sandd.models import PredictLottery from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict_sandd.predict_append_rule').log() #获取predict driver def spider_predict_selenium(): driver_flag = True while (driver_flag): driver = webdriver.Firefox( executable_path='E:\\python\\webdriver\\firefox\\geckodriver.exe') driver.get("https://www.1399p.com/pk10/shdd") try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located( (By.CLASS_NAME, "lotteryNumber"))) driver_flag = False
#coding=utf-8 __author__ = 'shifeixiang' import time from selenium import webdriver from bs4 import BeautifulSoup from append_predict.models import KillPredict from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.predict_append_rule_100_continue5').log() #获取predict driver def spider_predict_selenium(): driver_flag = True while (driver_flag): driver = webdriver.Firefox( executable_path='./pkten_log/geckodriver.exe') driver.get("https://www.1399p.com/pk10/shdd") try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located( (By.CLASS_NAME, "lotteryNumber"))) driver_flag = False return driver
from append_predict_sandd.models import ProbUser from append_purchase_lide_sandd.client_thread import ThreadControl from append_purchase_lide_sandd.purchase_driver import get_driver from append_predict_sandd.models import KillPredict import datetime from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_lide_sandd.purchase_client_main').log() class Singleton(object): def __new__(cls, *args, **kw): if not hasattr(cls, '_instance'): orig = super(Singleton, cls) cls._instance = orig.__new__(cls, *args, **kw) return cls._instance class SingleDriver(Singleton): # def __init__(self, driver): # self.driver = driver def get_driver(self): return self.driver def set_driver(self, driver): self.driver = driver
#coding=utf-8 __author__ = 'shifeixiang' import urllib2 import time import simplejson from append_predict.models import PredictLottery from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.spider_pk10').log() def get_html_result(): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', } current_date = time.strftime('%Y-%m-%d', time.localtime(time.time())) #就接口 # url = "http://api.api68.com/pks/getPksHistoryList.do?date=" + current_date + "&lotCode=10001" flag = True count = 0 while (flag): try: if count % 2 == 1: url = "http://e.apiplus.net/daily.do?token=t3cffb3f43eb3c9b1k&code=bjpk10&format=json&date=" + current_date else: url = "http://z.apiplus.net/daily.do?token=t3cffb3f43eb3c9b1k&code=bjpk10&format=json&date=" + current_date print url pk_logger.info("url:%s", url)
from append_purchase.client_thread import ThreadControl from append_purchase.purchase_driver import get_driver from append_predict.spider_pk10 import get_html_result,load_lottery_predict, get_lottery_id_number from append_predict.main import get_predict_model_value from append_predict.models import KillPredict import datetime from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase.purchase_client_main').log() class Singleton(object): def __new__(cls, *args, **kw): if not hasattr(cls, '_instance'): orig = super(Singleton, cls) cls._instance = orig.__new__(cls, *args, **kw) return cls._instance class SingleDriver(Singleton): # def __init__(self, driver): # self.driver = driver def get_driver(self): return self.driver def set_driver(self, driver): self.driver = driver
#coding=utf-8 __author__ = 'shifeixiang' from django.views.decorators.csrf import csrf_exempt #用于处理post请求出现的错误 from django.shortcuts import render_to_response import time from append_predict.models import KillPredictTotal from append_predict.models import KillPredict from append_predict.models import PredictLottery import datetime from append_predict.spider_pk10 import get_html_result, get_lottery_id_number, load_lottery_predict from append_predict.main import calculate_percisoin from pkten_log.pk_log import PkLog pk_logger = PkLog('append_predict.report').log() def predict_report(request): current_date = time.strftime('%Y-%m-%d', time.localtime(time.time())) obj_pro_predict = KillPredict.objects.filter( kill_predict_date=current_date) #print "obj_pro",obj_pro_predict return render_to_response('append_predict_list.html', {"obj_pro_predict": obj_pro_predict}) #更新,处理lottery_number为空的情况 def control_predict_report(request): try: in_date = request.POST['in_date']
#coding=utf-8 __author__ = 'shifeixiang' import time import threading import datetime import append_purchase_lide_sandd.purchase_client_main from pkten_log.pk_log import PkLog pk_logger = PkLog('append_purchase_lide_sandd.client_thread').log() class Spider(threading.Thread): # __metaclass__ = Singleton thread_stop = False thread_num = 0 interval = {} behavior = None def run(self): self.behavior(self, self.thread_num, self.interval) def stop(self): self.thread_stop = True class ThreadControl(): thread_stop = False current_thread = {}