コード例 #1
0
ファイル: analyse_detail.py プロジェクト: lili10000/football
def getRate(id):
    ipObj = ipTool()
    ipList = ipObj.getIpList()
    while 1:
        # url = "https://odds.500.com/fenxi/yazhi-{}.shtml".format(id)
        url = "https://odds.500.com/fenxi/daxiao-{}.shtml".format(id)
        while 1:
            try:
                soup = BeautifulSoup(getHtmlText(url, ipList), features="html.parser")
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                try: 
                    tr = soup.find('tr', id='3')
                    if tr == None:
                        return None
                    td = tr.find('td', class_="tb_tdul_pan")
                    rate = abs(float(td.attrs['ref']))
                    return float(rate)
                except Exception as e:
                    print(e)
                    if len(ipList) < 2:
                        ipList = ipObj.getIpList()
            except Exception as e:
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                continue
            return None   
コード例 #2
0
ファイル: data_v4.py プロジェクト: lili10000/football
def working(tableName):
    sql = sqlMgr('localhost', 'root', '861217', 'football')
    ipObj = ipTool()
    ipList = ipObj.getIpList()
    index = 1
    end = 2
    # if checkFlag:
    #     end = 2
    outputInfo = {}
    gameCode = []
    gameCode = sql.queryByTypeAll(tableName)
    # 买预备=========================
    gameIndex = 0

    while index < end:
        gameIndex = 0
        while gameIndex < len(gameCode):
            url = "https://www.dszuqiu.com/league/" + str(
                gameCode[gameIndex][0]) + "/p.1"
            url = url.replace("p.1", "p." + str(index))

            try:
                html = parser(url, ipList, sql)
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
            except:
                # time.sleep(10)
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                # print ("connect err")
                continue

            # print( index, gameCode[gameIndex][2])
            try:
                if html.getData("k_corner", gameCode[gameIndex],
                                outputInfo) == False:
                    break
            except:
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                # print ("error :")
            # time.sleep(1)

            gameIndex += 1
        index += 1

        values = list(outputInfo.keys())
        values.sort()

        for value in values:
            for tmp in outputInfo[value]:
                writeFile(tmp)

        outputInfo.clear()
        info = "================================"
        writeFile(info)
コード例 #3
0
ファイル: baseAnalyse.py プロジェクト: lili10000/football
def working(tableName):
    sql = sqlMgr('localhost', 'root', '861217', 'football')
    ipObj = ipTool()
    ipList = ipObj.getIpList()
    index = 1
    end = 40

    gameCode = []
    gameCodeAll = sql.queryByTypeAll("k_gameDic_v2")

    for code in gameCodeAll:
        dataRecv = sql.queryCount(tableName, code[1])
        gameCount = dataRecv[0][0]
        if gameCount < end * 9:
            gameCode.append(code)

    if type == 1:
        gameCode = gameCodeAll
        end = 2

    if len(gameCode) == 0:
        return
    # 买预备=========================
    gameIndex = 0

    while index < end:
        gameIndex = 0
        while gameIndex < len(gameCode):
            url = "https://www.dszuqiu.com/league/" + str(
                gameCode[gameIndex][0]) + "/p.1"
            url = url.replace("p.1", "p." + str(index))

            try:
                html = parser(url, ipList, sql)
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
            except:
                # time.sleep(10)
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                # print ("connect err")
                continue

            print(index, gameCode[gameIndex][1])
            try:
                if html.getData(tableName, gameCode[gameIndex]) == False:
                    break
            except:
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                # print ("error :")
            # time.sleep(1)

            gameIndex += 1
        index += 1
コード例 #4
0
ファイル: result_v17.py プロジェクト: lili10000/football
def updata(code):
    ipObj = ipTool()
    ipList = ipObj.getIpList()
    url = "https://www.dszuqiu.com/race/baijia/{}?t=8".format(code)
    print(url)
    while 1:

        try:
            html = parser(url, ipList)
            if len(ipList) < 2:
                ipList = ipObj.getIpList()
        except:
            if len(ipList) < 2:
                ipList = ipObj.getIpList()
            continue
        return html.getData()
コード例 #5
0
def threadFun(id):
    ipObj = ipTool()
    # ipList = ipObj.getIpList()
    sql = sqlMgr('localhost', 'root', '861217', 'football')

    count = sql.queryCountId("k_gameinfodetail", id)
    count = count[0][0]
    if count > 0:
        return

    ipList = ipObj.getIpList()
    url = "https://odds.500.com/fenxi/shuju-{}.shtml".format(id)
    while 1:
        try:
            html =  parser(url, ipList, sql)
            html.getData(id)
            print(id,"  ok")
            break
        except Exception as e:
            if len(ipList) < 2:
                break
コード例 #6
0
ファイル: analyse_detail.py プロジェクト: lili10000/football
def getData(id):
    ipObj = ipTool()
    ipList = ipObj.getIpList()
    while 1:
        url = "https://odds.500.com/fenxi/shuju-{}.shtml".format(id)
        while 1:
            try:
                html =  parser(url, ipList)
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                try: 
                    return html.getData(id)
                except Exception as e:
                    print(e)
                    if len(ipList) < 2:
                        ipList = ipObj.getIpList()
            except Exception as e:
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
                continue
            return [None, None, None]
コード例 #7
0
ファイル: analyse_detail.py プロジェクト: lili10000/football
def working(url):
    channelOut = queue.Queue()
    threadPool = []

    ipObj = ipTool()
    ipList = ipObj.getIpList()
    end = threading.Thread(target=threadLogOut,args=(channelOut,))
    end.start()


    while 1:   
        try:
            soup = BeautifulSoup(getHtmlText(url, ipList), features="html.parser")
            if len(ipList) < 2:
                ipList = ipObj.getIpList()
            try: 
                tbody = soup.find('tbody', id='match_list_tbody')
                gameList = []
                for tr in tbody.find_all('tr'):
                    gameList.append(tr.attrs['data-fid'])
                for id in gameList:
                    t=threading.Thread(target=threadFun,args=(id,channelOut))
                    threadPool.append(t)
                    t.start()
            except Exception as e:
                print(e)
                if len(ipList) < 2:
                    ipList = ipObj.getIpList()
        except Exception as e:
            if len(ipList) < 2:
                ipList = ipObj.getIpList()
            continue
        break
    for t in threadPool:
        t.join()
    print("end work ")
    time.sleep(60*3)
    return
コード例 #8
0
            def getDataThread(url, gameCode):
                while 1:
                    ipObj = ipTool()
                    ipList = ipObj.getIpList()
                    sql = sqlMgr('localhost', 'root', '861217', 'football')
                    try:
                        html = parser(url, ipList, sql)
                        if len(ipList) < 2:
                            ipList = ipObj.getIpList()
                    except:
                        # time.sleep(10)
                        if len(ipList) < 2:
                            ipList = ipObj.getIpList()
                        # print ("connect err")
                        continue

                    print(index, gameCode[1])
                    try:
                        if html.getData("k_gamedic_v3", gameCode) == False:
                            break
                    except:
                        if len(ipList) < 2:
                            ipList = ipObj.getIpList()
                    return
コード例 #9
0
def working(url):
    
    codeList = tool.getGameCodeList(url)

    threadPool = []

    print("start work, code size:", len(codeList))
    ipObj = ipTool()
    ipList = ipObj.getIpList()

    count = 0
    for id in codeList:
        # id = index + start
        # channel.put(id)
        t=threading.Thread(target=threadFun,args=(id,))
        t.start()
        threadPool.append(t)
        count += 1
        if count % 20 == 0:
            for t in  threadPool:
                t.join()

    for t in  threadPool:
        t.join()
コード例 #10
0
def working(tableName):
    sql = sqlMgr('localhost', 'root', '861217', 'football')
    ipObj = ipTool()
    ipList = ipObj.getIpList()
    index = 1
    end = 2
    # if checkFlag:
    #     end = 2
    outputInfo = {}
    gameCode = []
    gameCode = sql.queryByTypeAll(tableName)
    # 买预备=========================
    gameIndex = 0

    while index < end:
        gameIndex = 0
        threadPool = []
        while gameIndex < len(gameCode):
            url = "https://www.dszuqiu.com/league/" + str(
                gameCode[gameIndex][0]) + "/p.1"
            url = url.replace("p.1", "p." + str(index))

            # try:
            #     html =  parser(url, ipList, sql)
            #     if len(ipList) < 2:
            #         ipList = ipObj.getIpList()
            # except:
            #     # time.sleep(10)
            #     if len(ipList) < 2:
            #         ipList = ipObj.getIpList()
            #     # print ("connect err")
            #     continue

            # print( index, gameCode[gameIndex][1])
            # try:
            #     html.getData("k_corner", gameCode[gameIndex], outputInfo)
            # except:
            #     if len(ipList) < 2:
            #         ipList = ipObj.getIpList()
            #     # print ("error :")
            # # time.sleep(1)
            # gameIndex += 1

            def getDataThread(url, gameCode):
                while 1:
                    ipObj = ipTool()
                    ipList = ipObj.getIpList()
                    sql = sqlMgr('localhost', 'root', '861217', 'football')
                    try:
                        html = parser(url, ipList, sql)
                        if len(ipList) < 2:
                            ipList = ipObj.getIpList()
                    except:
                        # time.sleep(10)
                        if len(ipList) < 2:
                            ipList = ipObj.getIpList()
                        # print ("connect err")
                        continue

                    print(index, gameCode[1])
                    try:
                        if html.getData("k_gamedic_v3", gameCode) == False:
                            break
                    except:
                        if len(ipList) < 2:
                            ipList = ipObj.getIpList()
                    return

            t = threading.Thread(target=getDataThread,
                                 args=(
                                     url,
                                     gameCode[gameIndex],
                                 ))
            t.start()
            threadPool.append(t)
            gameIndex += 1
            if gameIndex % 10 == 0:
                count = 0
                for thread in threadPool:
                    thread.join()

        for thread in threadPool:
            thread.join()

        index += 1