From fe831750d31921933a831bf99673e2b096ca6f33 Mon Sep 17 00:00:00 2001 From: lottopy Date: Wed, 15 Jun 2022 17:42:37 -0400 Subject: [PATCH] painful repo management --- README.md | 11 +++++++++++ cash25.py | 45 ++++++++++++++++++++++++++++++++++++++++++ daily3.py | 44 +++++++++++++++++++++++++++++++++++++++++ daily4.py | 44 +++++++++++++++++++++++++++++++++++++++++ lotto_america.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ lottopy_pb.py | 50 +++++++++++++++++++++++++++++++++++++++++++++++ megamil.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 2 ++ start.sh | 18 +++++++++++++++++ 9 files changed, 316 insertions(+) create mode 100644 README.md create mode 100755 cash25.py create mode 100755 daily3.py create mode 100755 daily4.py create mode 100755 lotto_america.py create mode 100755 lottopy_pb.py create mode 100755 megamil.py create mode 100644 requirements.txt create mode 100755 start.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..ae54f4f --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# wvlottopy + +THE WVLOTTOPY DEVELOPERS HAVE NO AFFILIATION WITH THE WEST VIRGINIA STATE LOTTERY + +This script generates the most likely lottery numbers based off frequency of winning numbers. + +Previously there were records dating back to 1992 that were removed by the website, which has lead me to rewrite and encourage the collaboration and sharing of this work. I will attach an excel file in the near future that includes the previous records and soon try to reincorperate them into the script. Originally excel functionality was stripped for performance. + +I am welcoming anyone who wants to to port it to their own state/country to do so. I currently have a website www.wvlotterypredictor.xyz hosting my numbers to be refreshed daily. Collaboration and suggestion to a more accurate algorithm is also welcome. + +#Good luck! \ No newline at end of file diff --git a/cash25.py b/cash25.py new file mode 100755 index 0000000..bdd319d --- /dev/null +++ b/cash25.py @@ -0,0 +1,45 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +import pandas as pd +import requests +from collections import Counter + +def get_data(): + url = 'https://wvlottery.com/draw-games/cash-25/?game-analyze=cash-25&what-to-search=historysearch&date-range=-1' + 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 = pd.read_html(r.text) + pd.set_option('display.max_rows', None) + # Specifies no max rows, otherwise only shows 10 records + df = dfs[0] + df2 = df[['Date', 'Numbers']] + date = list(df2['Date']) + nums = list(df2['Numbers'].astype('str')) + return date, nums + +date, nums = get_data() + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('–',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 25): + most_common= Counter(sep).most_common(6) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency) +Chance = frac(total_freq, 177100) # Chance = number call freq / all possible numbers i.e. 177100 +Winning_Numbers = str("-".join(sorted_nums)) + +print(f"Likely numbers are . . . {Winning_Numbers} \n" +f"With percent chance of winning being {Chance}") diff --git a/daily3.py b/daily3.py new file mode 100755 index 0000000..d80903e --- /dev/null +++ b/daily3.py @@ -0,0 +1,44 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +import pandas as pd +import requests +from collections import Counter + +def get_data(): + url = 'https://wvlottery.com/draw-games/daily-3/?game-analyze=daily-3&what-to-search=historysearch&date-range=1' + 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 = pd.read_html(r.text) + pd.set_option('display.max_rows', None) + # Specifies no max rows, otherwise only shows 10 records + df = dfs[0] + df2 = df[['Date', 'Numbers']] + date = list(df2['Date']) + nums = list(df2['Numbers'].astype('str')) + return date, nums + +date, nums = get_data() + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('–',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 10): + most_common= Counter(sep).most_common(3) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency) +Chance = frac(total_freq, 1000) # Chance = number call freq / all possible numbers i.e. 1000 +Winning_Numbers = str("-".join(sorted_nums)) + +print(f"Likely numbers are . . . {Winning_Numbers} \n" +f"With percent chance of winning being {Chance}") \ No newline at end of file diff --git a/daily4.py b/daily4.py new file mode 100755 index 0000000..3ab1a7f --- /dev/null +++ b/daily4.py @@ -0,0 +1,44 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +import pandas as pd +import requests +from collections import Counter + +def get_data(): + url = 'https://wvlottery.com/draw-games/daily-4/?game-analyze=daily-4&what-to-search=historysearch&date-range=-1' + 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 = pd.read_html(r.text) + pd.set_option('display.max_rows', None) + # Specifies no max rows, otherwise only shows 10 records + df = dfs[0] + df2 = df[['Date', 'Numbers']] + date = list(df2['Date']) + nums = list(df2['Numbers'].astype('str')) + return date, nums + +date, nums = get_data() + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('–',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 9): + most_common= Counter(sep).most_common(4) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency) +Chance = frac(total_freq, 10000) # Chance = number call freq / all possible numbers i.e. 10000 +Winning_Numbers = str("-".join(sorted_nums)) + +print(f"Likely numbers are . . . {Winning_Numbers}, \n" +f"With percent chance of winning being {Chance}") \ No newline at end of file diff --git a/lotto_america.py b/lotto_america.py new file mode 100755 index 0000000..4a3c497 --- /dev/null +++ b/lotto_america.py @@ -0,0 +1,51 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +import pandas as pd +import requests +from collections import Counter + +def get_data(): + url = 'https://wvlottery.com/draw-games/lotto-america/?game-analyze=lotto-america&what-to-search=historysearch&date-range=-1' + 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 = pd.read_html(r.text) + pd.set_option('display.max_rows', None) + # Specifies no max rows, otherwise only shows 10 records + df = dfs[0] + df2 = df[['Date', 'Numbers', 'SB', 'All Star']] + date = list(df2['Date']) + nums = list(df2['Numbers'].astype('str')) + SBs = list(df2['SB'].astype('int')) + return date, nums, SBs + +date, nums, SBs = get_data() + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('–',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 52): + most_common= Counter(sep).most_common(5) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +for n in range(0, 10): + most_common_sb = Counter(SBs).most_common(1) + SB = [v[0] for v in most_common_sb] + frequency_sb = [v[-1] for v in most_common_sb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency + frequency_sb) +Chance = frac(total_freq, 25989600) # Chance = number call freq / all possible numbers i.e. 25,989,600 +Winning_Numbers = str("-".join(sorted_nums)) + +print(f"Likely numbers are . . . {Winning_Numbers} SB: {SB}\n" +f"With percent chance of winning being {Chance}") diff --git a/lottopy_pb.py b/lottopy_pb.py new file mode 100755 index 0000000..9439237 --- /dev/null +++ b/lottopy_pb.py @@ -0,0 +1,50 @@ +# WVLottopy: Matteo DiBiagio +from fractions import Fraction as frac +import pandas as pd +import requests +from collections import Counter + +def get_data(): + url = 'https://wvlottery.com/draw-games/powerball/?game-analyze=powerball&what-to-search=historysearch&date-range=-1' + 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 = pd.read_html(r.text) + pd.set_option('display.max_rows', None) + # Specifies no max rows, otherwise only shows 10 records + df = dfs[0] + df2 = df[['Date', 'Numbers', 'PB', 'PPX', 'Winners WV Only', 'Payout WV Only']] + date = list(df2['Date']) + nums = list(df2['Numbers'].astype('str')) + PBs = list(df2['PB'].astype('int')) + return date, nums, PBs + +date, nums, PBs = get_data() + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('–',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 69): + most_common = Counter(sep).most_common(5) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +for n in range(0, 26): + most_common_pb = Counter(PBs).most_common(1) + PB = [v[0] for v in most_common_pb] + frequency_pb = [v[-1] for v in most_common_pb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency + frequency_pb) +Chance = frac(total_freq, 292201338) # Chance = number call freq / all possible numbers i.e. 292201338 +Winning_Numbers = str("-".join(sorted_nums)) + +print(f"Likely numbers are . . . {Winning_Numbers} PB: {PB}\n" +f"With percent chance of winning being {Chance}") \ No newline at end of file diff --git a/megamil.py b/megamil.py new file mode 100755 index 0000000..80b63bd --- /dev/null +++ b/megamil.py @@ -0,0 +1,51 @@ +# WVLottopy megamil: Matteo DiBiagio +from fractions import Fraction as frac +import pandas as pd +import requests +from collections import Counter + +def get_data(): + url = 'https://wvlottery.com/draw-games/mega-millions/?game-analyze=mega-millions&what-to-search=historysearch&date-range=-1' + 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 = pd.read_html(r.text) + pd.set_option('display.max_rows', None) + # Specifies no max rows, otherwise only shows 10 records + df = dfs[0] + df2 = df[['Date', 'Numbers', 'MB', 'MP']] + date = list(df2['Date']) + nums = list(df2['Numbers'].astype('str')) + MBs = list(df2['MB'].astype('int')) + return date, nums, MBs + +date, nums, MBs = get_data() + +# Formatting +hyphenfree = [] +for x in nums: + hyphenfree.append(x.replace('–',', ')) +splitlist = ", ".join(hyphenfree) +sep = splitlist.split(", ") + +for n in range(0, 70): + most_common= Counter(sep).most_common(5) + likely_nums = [v[0] for v in most_common] + frequency = [v[-1] for v in most_common] + +for n in range(0, 25): + most_common_mb = Counter(MBs).most_common(1) + MB = [v[0] for v in most_common_mb] + frequency_mb = [v[-1] for v in most_common_mb] + +sorted_nums = sorted(likely_nums) +total_freq = sum(frequency + frequency_mb) +Chance = frac(total_freq, 302575350) # Chance = number call freq / all possible numbers i.e. 11238513 +Winning_Numbers = str("-".join(sorted_nums)) + +print(f"Likely numbers are . . . {Winning_Numbers} MB: {MB}\n" +f"With percent chance of winning being {Chance}") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d37d055 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pandas==1.3.5 +requests==2.26.0 \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..21a7460 --- /dev/null +++ b/start.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Simple start script for lottopy designed by Matteo DiBiagio +# www.wvlotterypredictor.xyz +# MIT License +# Edit to your need + +echo "Powerball" && +python lottopy_pb.py && +echo "MegaMillions" && +python megamil.py && +echo "Lotto America" && +python lotto_america.py && +echo "Daily3" && +python daily3.py && +echo "Daily4" && +python daily4.py && +echo "Cash25" && +python cash25.py