switched to the new wvlottery.com results api, added cash pop

This commit is contained in:
2026-09-26 02:29:40 -04:00
parent ec34469663
commit d26a0970b8
11 changed files with 176 additions and 48 deletions
+14 -7
View File
@@ -3,7 +3,6 @@ from fractions import Fraction as frac
import pandas as pd
import requests
from collections import Counter
from io import StringIO
def get_data():
@@ -11,15 +10,23 @@ def get_data():
df_old = pd.read_excel('./excel_lotto_records/cash25.xlsx')
salvaged = df_old[['Date', 'Numbers']]
url = 'https://wvlottery.com/draw-games/cash-25/?game-analyze=cash-25&what-to-search=historysearch&date-range=-1'
url = 'https://gateway.loyalty.wvlottery.com/services/jackpot/api/v1/jackpot-results?gameId=10&jackpotStatus=PAYABLE&size=500&sort=externalId,drawDate,desc&page='
header = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36",
"X-Requested-With": "XMLHttpRequest"
}
# Get web data
r = requests.get(url, headers=header)
dfs = list(pd.read_html(StringIO(r.text)))
# Get web data, the new site pulls past draws from json 500 at a time
web = {'Date': [], 'Numbers': []}
page = 0
while True:
r = requests.get(url + str(page), headers=header)
data = r.json()
for x in data['content']:
web['Date'].append(x['drawingDate'])
web['Numbers'].append('–'.join(str(n['data']) for n in x['resultData'] if n['type'] == 'REGULAR'))
if data['last']:
break
page += 1
dfs = [pd.DataFrame(web)]
pd.set_option('display.max_rows', None)
# Specifies no max rows, otherwise only shows 10 records
df = pd.concat([dfs[0], salvaged], ignore_index=True)