It is currently 21 Oct 2019, 21:13

The Lottery Forum - Lottery Generators
• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

The lottery forum section of gimplearn.net will be here for historical purposes, as we have
created a brand new stand-alone forum at https://gimplearn.net/thelotteryforum/.
Please try to register and post there instead

TLF Topics: Active | Unanswered | Random
TLF Posts: Unread | New | Random
Lottery Forum
     Lottery/General Program Requests | Lottery Generators |🡆 Lottery CodeSkulptor Programs
     General Programs
     Chit Chat
Social:  Say Hello | Anything Goes | Shares

Lottery CodeSkulptor ProgramsGet Canadian Pick Games Data (CS Program)

Lottery Programs coded in CodeSkulptor
Forum rules
This forum is now locked.
Please visit The Lottery Forum (New)
Locked
tim

GL Blogger

Get Canadian Pick Games Data (CS Program)

Post#1 by tim » 18 Mar 2019, 14:33


This is for grabbing/parsing Pick 2,3 and Pick 4 games results data in a friendly text format in Canada.
You can access the CodeSkulptor program here --> Canadian Pick 2,3,4 games data CS Program
----------- INSTRUCTIONS -------------
  1. Go to https://www.wclc.com
  2. Pick "Games and Extras" Under "Winning Numbers" Menu.
  3. At the bottom click to the month in the past that you
  4. want to pull data from.
  5. Wait for page to finish loading.
  6. Ctrl+A (This is important, don't view source)
  7. But now Right click then select "View Selection Source"
  8. Ctrl+A to select All, Ctrl+C to Copy all source code of Selection Source
  9. Run this program (top left "Run" button).
  10. Ctrl+V to paste source code into box when prompted
  11. That's it it'll parse the data and print out on right window
    (output window) results from oldest to latest
    draws, one draw on each line

    Code for reference:

    Code: Select all

    #This program will parse draw data results page
    # of selection source of https://www.wclc.com
    
    # --------- INSTRUCTIONS ------------------------------------
    # Go to https://www.wclc.com
    # Pick "Games and Extras" Under "Winning Numbers" Menu.
    # At the bottom click to the month in the past that you
    # want to pull data from.
    # Wait for page to finish loading.
    # Ctrl+A (This is important, don't view source)
    # But now Right click then select "View Selection Source"
    # Ctrl+A to select All, Ctrl+C to Copy all source code of Selection Source
    # Run this program (top left "Run" button).
    # Ctrl+V to paste source code into box when prompted
    # That's it it'll parse the data and print out on right window
    #    (output window) results from oldest to latest 
    #    draws, one draw on each line
    # -----------------------------------------------------------
    
    #Developer notes:
    #For pick 2s,3s and 4s, source looks like this
    #<ul class="pastWinNumbers">
    #		              <li class="pastWinNumber">7</li>
    #		              <li class="pastWinNumber">7</li>
    #		          	<li class="pastWinNumLogoPICK2SMALL"></li>
    #        		</ul>
    #          <ul class="pastWinNumbers">
    #                <li class="pastWinNumber">6</li>
    #                <li class="pastWinNumber">2</li>
    #                <li class="pastWinNumber">9</li>
    #            	<li class="pastWinNumLogoPICK3SMALL"></li>
    #          </ul>
    #        		<ul class="pastWinNumbers">
    #		              <li class="pastWinNumber">4</li>
    #		              <li class="pastWinNumber">2</li>
    #		              <li class="pastWinNumber">1</li>
    #		              <li class="pastWinNumber">8</li>
    #		          	  <li class="pastWinNumLogoPICK4SMALL"></li>
    #        		</ul>
    
    def pos_minimum(pos1,pos2,str1,str2):
        pos = -1
        s = ""
        if pos1 >= 0:
            pos = pos1
            s = str1
        if pos2 >= 0 and (pos2 < pos1 or pos1 < 0):
            pos = pos2
            s = str2
        return pos,s
    source = input("Please paste https://www.wclc.com's Past results page sourcecode:")
    ul_start = '<ul class="pastWinNumbers">'
    ul_end = '</ul>'
    li = '<li class="pastWinNumber">'
    li_end = '<'
    li_bonus = '<li class="bonus'
    li_bonus_2 = '>'
    
    start = 0
    start_i = source.find(ul_start,start)  
    draws = []
    pick = int(input("Enter Type of Pick (2,3 or 4) to filter out (ie.Enter 3 for Pick-3)"))
    while (start_i >= 0):
        end_i = source.find(ul_end,start_i + len(ul_start))
        text = source[start_i + len(ul_start):end_i]
        #print (text)
        #here we have text which contains the ul element inner code
        startpos = 0
        li_start_i = text.find(li,startpos)
        li_start_i2 = text.find(li_bonus,startpos)
        start_pos,st = pos_minimum(li_start_i,li_start_i2,li,li_bonus)
        draw = []
        while (start_pos >= 0): #we have an li or a libonus
            #look for bonus end
            bonus = False
            startpos = start_pos + len(st)
            if st == li_bonus:
                bonus = True
                next_pos = text.find(li_bonus_2,startpos)
                startpos = next_pos + len(li_bonus_2)
            end_pos = text.find(li_end,startpos)
            inner_text = text[startpos:end_pos]
            #print (inner_text.strip())
            if bonus:
                draw.append('('+inner_text.strip()+')')
            else:
                draw.append(inner_text.strip())
            #elements.append(int(inner_text.strip()))
            li_start_i = text.find(li,startpos)
            li_start_i2 = text.find(li_bonus,startpos)
            start_pos,st = pos_minimum(li_start_i,li_start_i2,li,li_bonus)
        if len(draw) == pick:
            draws.append(draw)
        start = start_i + len(ul_start)
        start_i = source.find(ul_start,start)  
    draws = draws[::-1]
    for draw in draws:
        print ("-".join(draw))
        
         
    
    Sample data output result for Pick 3 (Canada game):

    Code: Select all

    8-3-1
    3-9-7
    0-8-6
    7-8-4
    6-2-6
    3-6-5
    9-6-0
    0-0-2
    9-1-6
    5-0-4
    3-4-3
    5-7-9
    5-6-1
    2-2-5
    4-5-2
    6-9-0
    2-9-6
    
0 x
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         


TLF Topics: Active | Unanswered | Random
TLF Posts: Unread | New | Random
Lottery Forum
     Lottery/General Program Requests | Lottery Generators |🡆 Lottery CodeSkulptor Programs
     General Programs
     Chit Chat
Social:  Say Hello | Anything Goes | Shares

Locked
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests