Coding issue... bonus balls.

Published:

I have my build script down to a single function that works flawlessly for scraping the PA lottery website for the full histories of the following games...

Pick 2,3,4 and 5 mid and eve

Match 6, Cash 5, Treasure Hunt.

The issue... only able to grab the white balls from Cash 4 Life, Power Ball and Mega Millions.

Why? I used a regex to drop the non numeric data so I would skip storing the pick N wild ball data, and it was like using a chain saw where a scalpel was called for...

I need to come up with a way to not only read the bonus ball data, but to divert it to it's own csv file...

The diversion is the easier part.

Gotta spend some time on this... i am almost there with the build script, and if it works, the update script will be easy.

Entry #545

Comments

Avatar hypersoniq -
#1
The main issue here is trying to find a one size approach so that one single function can read any game. I already have 11 out of 14 games that detect automatically and dynamically assign header rows (pick 2 has A and B, Match 6 has A through F... no intervention on my part, so I am not that far away...

2 possible solutions present immediately...

1. Have a "bonus ball" version. Not ideal bjt if it works...

2. Write a smarter regex filter (regex = regular expression). I already have it dismissing text and only recording numbers, but it cuts off everything after the first text data. Works for skipping wild ball data, not so much for needed bonus ball data.
Avatar hypersoniq -
#2
Of course, powerball and mega have RESTful APIs, I could just write a second function for that, making it easier to grab exactly what I need in json format... and Cash 4 Life will be done for in February anyway.

In this way, the update version can use the last date in the csv file created with the build script, and just capture dates ahead of it...

Will give the big game APIs a closer look tomorrow. Looks like I will need to register for an API key, but MUSL has both games as endpoints... did you know that the powerball data includes draw ordering of the balls?

Post a Comment

Please Log In

To use this feature you must be logged into your Lottery Post account.

Not a member yet?

If you don't yet have a Lottery Post account, it's simple and free to create one! Just tap the Register button and after a quick process you'll be part of our lottery community.

Register