Quick Update (17th January, 2012):
- I have created an extension for Google Chrome that allows you to view the latest Play Whe results. Check it out here: Play Whe Results Viewer
- You can view even more results and statistics if you follow this link: Play Whe Smarter
- And finally, you can like the Play Whe Smarter page on facebook to keep up to date with the latest tricks and strategies for winning at Play Whe. Like us here: Play Whe Smarter
Play Whe is a numbers game brought to Trinidad by Chinese immigrants. Its usually played by persons who are influenced by intuition, superstition, dreams and caprice. The rules to the game are pretty simple. You have 36 numbers, 1 through 36. When a number is drawn the person(s) who selected that number wins a sum of money; $24 to every $1 that was played. Everyday (except Sundays and public holidays) there are two drawings, one at 1:00pm and the other at 6:30pm.
The NLCB provides a Play Whe Statistics form that can be used to query the numbers that were drawn on any given day way back to the first draw on July 4th, 1994.
That is great.
However, the results are not returned and can’t be returned in a program friendly format. json or XML would have been nice. Even if the HTML it returned was properly marked-up I would have been thankful, but that is not the case either. I am still lucky though, because there seems to be some consistency to the data and so it can be extracted using regular expressions.
Let’s assume we want to get a “Monthly Summary” for April, 2011. Well, we will need to figure out how the Play Whe Statistics form is querying the server. If we fire up Live HTTP Headers in Firefox, we will be able to determine the POST request that’s being sent to the server when a query is made for the “Monthly Summary”. [By the way, I know its a POST request due to the fact that a GET request would have passed the arguments in the URL.]
The three highlighted regions in the dialog below gives us all the information we need.
With this information we can now write some Python code to make the query.
import urllib
sel = '/search/pwq/countdateCash.php'
host = 'nlcb.co.tt'
params = urllib.urlencode({
'month': 'Apr',
'year': 11
})
data = urllib.urlopen('http://' + host + sel, params).read()
print data
It returns some messed up HTML but with a little regular expression magic we can extract some useful information:
import re
pattern = r"(\d{2})-Apr-11: Draw # (\d+) : (AM|PM)'s draw was (\d+)"
results = re.findall(pattern, data)
# sorts by draw number and then prints the results
for res in sorted(results, key=lambda r: r[1]):
print res
Here’s a snippet of the data that’s returned:
('01', '10293', 'AM', '19') # the draw at 1:00pm
('01', '10294', 'PM', '23') # the draw at 6:30pm
('02', '10295', 'AM', '3')
('02', '10296', 'PM', '35')
('04', '10297', 'AM', '1')
('04', '10298', 'PM', '33')
('05', '10299', 'AM', '4')
('05', '10300', 'PM', '32')
('06', '10301', 'AM', '28')
('06', '10302', 'PM', '20')
('07', '10303', 'AM', '29')
('07', '10304', 'PM', '17')
('08', '10305', 'AM', '15')
('08', '10306', 'PM', '13')
('09', '10307', 'AM', '5')
('09', '10308', 'PM', '32')
...
That’s it. You now have a programmatic way for getting your current and past Play Whe results. Enjoy!


This is mind blasting for a noob like me. For python3 i made some (hopefully correct) changes for it to run properly. Yeah I could have run it in python2 but i said what the heck.
import urllib.request
import urllib.parse
sel = ‘/search/pwq/countdateCash.php’
host = ‘nlcb.co.tt’
params = urllib.parse.urlencode({
‘month’: ‘Apr’,
‘year’: 11
})
binary_params = params.encode(‘ascii’)
data = urllib.request.urlopen(‘http://’ + host + sel, binary_params).read()
nice :)… cool man… hopefully you ran it and it produced similar results to the python2 code
Those of you wishing to use the Play Whe API can get it here… http://pypi.python.org/pypi/playwhe
I am also working on some Play Whe plugins for firefox and chrome. To find out when that is ready you can join the Play Whe Smarter facebook group I started here… https://www.facebook.com/pages/Play-Whe-Smarter/107976305953213
If you’re a developer you can check out the latest source here… https://github.com/dwayne/playwhe
I am looking July and August play whe marks.
i would like to get all play whe result for the month of november 2011…thanks
hi salisha, sorry for the late reply… that is not a problem… i will email the results to you… if you are on facebook, you can also join the Play Whe Smarter facebook group I started