It is currently 16 Dec 2019, 06:07

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

Get Lottery Historical Draws Data for any State (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 Lottery Historical Draws Data for any State (CS Program)

Post#1 by tim » 17 Mar 2019, 15:43


This CS program can be accessed here --> Historical Data Parser CS Program
See post #2 for version 2 which outputs without hyphens (-) so that data can be fed into Frequency Counter Program.

The CS program will allow you to paste the source code of results (year) page (from lotteryusa.com) as input and it'll parse the source code and print out draw data in text friendly format. One draw per line, numbers separated by hyphens, if there's a bonus (mega or whatever it's called) it'll printed between brackets (ie. "2-5-32-42-52-(6)").

You can then possibly use this text data to use in other CS programs or for your own analyzing. How you use it is up to you.

--------- INSTRUCTIONS ------------------------------------
  1. Go to www.lotteryusa.com
  2. Click on home
  3. Click on a State
  4. Click on "Year" under "Past Results" of a Lottery Type
  5. Right-click then select "View Source" (or Control+U on Firefox)
  6. Ctrl+A to select All, Ctrl+C to Copy all source code
  7. Run this program (top left "Run" button).
  8. Ctrl+V to paste source code into box when prompted
  9. 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
cs code below for reference:

Code: Select all

#This program will parse draw data results page (for year)
#of the source code of one of the yearly results page on
#www.lotteryusa.com

# --------- INSTRUCTIONS ------------------------------------
# Go to www.lotteryusa.com
# Click on home
# Click on a State
# Click on "Year" under "Past Results" of a Lottery Type
# Right-click then select "View Source" (or Control+U on Firefox)
# Ctrl+A to select All, Ctrl+C to Copy all source code
# 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 3s, source looks like this
#<ul class="draw-result list-unstyled list-inline">
#                  <li>2</li>
#                  <li>2</li>
#                  <li>9</li>
#                        </ul>
#For no bonus games, source looks like this
#<ul class="draw-result list-unstyled list-inline">
#                  <li>10</li>
#                  <li>11</li>
#                  <li>18</li>
#                  <li>30</li>
#                  <li>36</li>
#                        </ul>
#For games with bonus looks like this
#<ul class="draw-result list-unstyled list-inline">
#                  <li>3</li>
#                  <li>29</li>
#                  <li>56</li>
#                  <li>62</li>
#                  <li>64</li>
#     <li class="bonus mega-ball">4
#                <span>MB</span></li>
#or it could look like this for powerball but class starts with "bonus"
#<ul class="draw-result list-unstyled list-inline">
#                  <li>30</li>
#                  <li>34</li>
#                  <li>39</li>
#                  <li>53</li>
#                  <li>67</li>
#                    <li class="bonus powerball">11
#                <span>PB</span></li>
#              <li class="extra">Power Play: 2</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 lotteryusa.com's Past results page sourcecode:")
ul_start = '<ul class="draw-result list-unstyled list-inline">'
ul_end = '</ul>'
li = '<li>'
li_end = '<'
li_bonus = '<li class="bonus'
li_bonus_2 = '>'

start = 0
start_i = source.find(ul_start,start)  
draws = []
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)
    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 from Florida Pick-3:

Code: Select all

2-6-0
9-4-2
2-6-9
6-3-8
1-8-9
2-1-7
6-5-3
4-7-2
4-6-3
9-7-6
9-9-4
4-0-9
4-6-2
2-5-3
6-2-3
1-5-8
0-3-2
1-1-2
0-0-7
6-9-6
5-0-4
5-8-2
3-1-9
7-8-1
1-2-6
9-7-9
7-2-8
8-5-2
2-1-4
9-9-9
6-7-9
8-3-1
3-1-8
5-3-5
7-1-4
5-6-4
8-6-0
9-7-4
8-4-2
8-8-4
2-2-5
7-3-5
4-8-5
8-4-1
7-8-5
1-3-7
2-5-1
0-0-8
0-2-9
5-0-7
9-1-6
2-1-8
4-5-4
7-6-5
6-9-6
2-4-5
0-2-8
4-7-0
8-8-1
6-7-9
5-5-1
7-7-5
6-9-4
3-2-2
7-9-0
1-0-2
5-9-6
1-7-4
6-0-6
5-2-3
4-2-1
5-5-2
9-1-5
0-8-1
3-7-8
4-4-9
5-4-9
7-8-9
6-7-3
2-7-7
1-4-8
2-0-7
6-6-8
2-9-9
7-3-5
1-4-3
8-1-3
9-7-0
2-2-2
9-8-8
5-5-2
9-5-9
7-0-1
9-0-3
9-1-8
1-9-0
7-0-9
3-0-7
5-5-7
0-4-0
0-0-2
8-1-7
5-7-0
1-7-9
2-3-8
9-8-5
5-9-3
2-9-5
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9
4-8-7
8-1-8
8-8-6
9-0-0
7-6-3
7-8-1
3-0-6
1-6-6
7-5-9
8-8-1
6-2-8
2-7-4
5-9-6
8-5-7
1-3-5
3-9-8
8-5-5
0-5-3
1-1-9
2-2-0
0-0-8
7-8-6
8-1-6
9-2-4
7-6-2
5-2-5
5-4-3
6-4-7
5-8-6
9-5-4
2-6-1
9-1-6
2-7-7
4-6-5
8-3-7
4-8-1
7-2-3
2-9-8
3-0-4
7-3-7
2-9-2
1-6-9
5-3-4
6-6-7
3-7-8
7-6-8
7-9-8
9-1-9
1-2-4
4-6-2
8-7-7
6-6-0
9-5-1
9-4-3
2-9-1
8-5-3
2-5-0
3-0-1
1-0-4
3-6-2
9-0-6
2-7-3
7-8-7
2-0-3
4-7-9
2-2-1
7-4-6
9-2-9
1-9-0
3-8-2
7-8-8
3-4-1
6-1-4
0-3-5
5-6-9
9-6-4
5-0-3
9-4-5
3-0-1
0-5-3
0-3-9
5-1-4
4-4-0
4-5-4
5-0-8
2-2-9
Sample data output result for Powerball:

Code: Select all

22-57-59-60-66-(7)
3-4-18-29-61-(25)
10-33-45-53-56-(24)
6-8-26-52-53-(21)
8-24-52-55-61-(21)
8-24-42-54-64-(24)
2-17-20-38-39-(20)
16-18-27-55-67-(18)
17-19-26-61-62-(15)
9-10-12-17-23-(9)
40-50-54-62-69-(19)
17-18-39-56-64-(12)
20-22-28-45-50-(8)
5-14-31-40-50-(6)
14-29-36-57-61-(17)
11-16-38-50-69-(19)
22-42-45-55-56-(14)
17-19-21-22-51-(19)
3-6-9-17-56-(25)
20-54-56-61-64-(7)
1-21-31-45-49-(21)
17-23-26-46-68-(20)
23-25-37-44-64-(7)
23-28-41-53-56-(14)
6-10-15-25-36-(14)
13-20-38-45-55-(1)
9-45-57-58-65-(9)
4-14-23-27-56-(13)
16-29-43-45-56-(25)
7-28-37-62-63-(15)
3-9-20-42-61-(24)
4-7-15-41-44-(10)
1-10-43-45-64-(22)
19-21-27-46-47-(7)
22-41-42-49-67-(11)
1-10-27-28-36-(12)
9-23-56-58-68-(1)
2-18-41-44-64-(26)
22-27-46-56-65-(13)
5-22-32-38-58-(26)
3-11-38-44-58-(2)
10-21-30-43-63-(17)
5-43-56-62-68-(24)
12-15-28-47-48-(16)
24-34-52-61-67-(16)
1-7-45-47-69-(13)
20-25-54-57-63-(8)
25-41-53-57-67-(12)
11-54-55-61-66-(9)
6-15-50-59-60-(13)
3-13-20-32-33-(21)
6-28-48-63-64-(24)
2-18-19-24-34-(3)
4-39-48-50-51-(11)
24-61-63-64-69-(18)
1-2-7-30-50-(8)
9-17-34-59-64-(22)
41-53-59-63-66-(3)
1-22-27-53-67-(15)
8-23-27-42-60-(7)
11-14-32-43-65-(15)
3-57-64-68-69-(15)
16-54-57-62-69-(23)
3-21-45-53-56-(22)
8-12-13-19-27-(4)
7-25-39-40-47-(20)
15-21-24-32-65-(11)
26-28-34-42-50-(25)
5-29-34-53-57-(24)
7-42-49-62-69-(23)
6-8-20-52-68-(5)
7-14-23-38-55-(18)
11-33-51-56-58-(18)
4-19-59-68-69-(21)
10-11-47-55-58-(26)
9-11-36-37-38-(11)
14-32-34-46-61-(10)
4-9-21-29-64-(26)
8-38-43-52-55-(17)
15-29-31-37-43-(16)
21-28-30-40-59-(26)
5-25-38-52-67-(24)
12-42-51-53-62-(25)
8-12-42-46-56-(12)
3-7-15-27-69-(19)
6-19-37-49-59-(22)
7-36-48-57-58-(24)
14-29-31-56-61-(1)
5-8-41-65-66-(20)
23-25-47-48-50-(24)
8-12-20-21-32-(10)
2-12-16-29-54-(6)
10-17-18-43-65-(13)
5-13-28-38-63-(21)
1-2-3-7-39-(25)
2-8-14-24-69-(26)
29-30-41-48-64-(1)
27-49-50-51-52-(2)
4-6-14-20-32-(13)
21-31-42-49-59-(23)
1-19-25-27-68-(21)
6-10-21-35-46-(23)
5-6-45-55-59-(14)
18-36-45-47-69-(14)
30-34-39-53-67-(11)
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.
         
0

tim
GL Blogger

Post#2 by tim » 23 Mar 2019, 22:49


This is version 2 of Historical Data Parser CS Program v2.
It doesn't produce hyphens (-) so that the output put can be fed into Frequency Counter.

Example output for pick3

Code: Select all

808
333
604
258
452
250
646
305
734
236
406
030
809
637
291
658
850
748
321
563
553
478
822
609
702
070
467
991
550
255
314
420
312
559
788
230
690
691
396
011
803
444
903
306
985
005
180
239
293
323
698
081
323
592
142
307
139
373
781
582
949
791
987
488
224
145
977
217
250
578
726
041
547
873
273
731
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.
         
0

homer
Forum Member

Post#3 by homer » 23 Mar 2019, 22:56


This historical parser to work with frequency counter is sweeet!
Thanks!
0


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 1 guest