diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 7fc1454..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,11 +0,0 @@ -# CHANGELOG - -## v1.0.0 (2023-08-10) - -### 中文版本 - -- TaiwanLottery 發布 1.0.0 版本. - -### English Version - -- TaiwanLottery released version 1.0.0 diff --git a/README.md b/README.md index 47467fe..915036b 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ print(result) --- -### 爬取指定年月的開獎紀錄(民國年份) +### 爬取指定年月的開獎紀錄(YYYY-MM) [威力彩](https://codesandbox.io/p/sandbox/da-le-tou-dang-yue-fen-de-kai-jiang-ji-lu-forked-ksq74y) @@ -132,7 +132,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.super_lotto(['112', '6']) +result = lottery.super_lotto(['2023', '06']) print(result) ``` @@ -142,7 +142,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.lotto649(['112', '6']) +result = lottery.lotto649(['2023', '06']) print(result) ``` @@ -152,7 +152,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.daily_cash(['112', '6']) +result = lottery.daily_cash(['2023', '06']) print(result) ``` @@ -162,7 +162,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.lotto1224(['112', '6']) +result = lottery.lotto1224(['2023', '06']) print(result) ``` @@ -172,7 +172,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.lotto3d(['112', '8']) +result = lottery.lotto3d(['2023', '08']) print(result) ``` @@ -182,7 +182,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.lotto4d(['112', '8']) +result = lottery.lotto4d(['2023', '08']) print(result) ``` @@ -192,7 +192,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.lotto38m6(['112', '8']) +result = lottery.lotto38m6(['2023', '08']) print(result) ``` @@ -202,7 +202,7 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.lotto39m5(['112', '8']) +result = lottery.lotto39m5(['2023', '08']) print(result) ``` @@ -212,21 +212,13 @@ print(result) from TaiwanLottery import TaiwanLotteryCrawler lottery = TaiwanLotteryCrawler() -result = lottery.lotto49m6(['112', '8']) +result = lottery.lotto49m6(['2023', '08']) print(result) ``` ## 資料來源 -- [威力彩](https://www.taiwanlottery.com.tw/Lotto/SuperLotto638/history.aspx) -- [大樂透](https://www.taiwanlottery.com.tw/Lotto/Lotto649/history.aspx) -- [今彩539](https://www.taiwanlottery.com.tw/Lotto/Dailycash/history.aspx) -- [雙贏彩](https://www.taiwanlottery.com.tw/Lotto/Lotto1224/history.aspx) -- [3星彩](https://www.taiwanlottery.com.tw/Lotto/3D/history.aspx) -- [4星彩](https://www.taiwanlottery.com.tw/Lotto/4D/history.aspx) -- [38樂合彩](https://www.taiwanlottery.com.tw/Lotto/38m6/history.aspx) -- [39樂合彩](https://www.taiwanlottery.com.tw/Lotto/39m5/history.aspx) -- [49 樂合彩](https://www.taiwanlottery.com.tw/Lotto/49m6/history.aspx) +- [https://www.taiwanlottery.com/lotto/history/history_result/](https://www.taiwanlottery.com/lotto/history/history_result/) ## License diff --git a/TaiwanLottery/__init__.py b/TaiwanLottery/__init__.py index 3639579..e48a779 100644 --- a/TaiwanLottery/__init__.py +++ b/TaiwanLottery/__init__.py @@ -1,491 +1,216 @@ # -*- coding: utf-8 -*- import logging -import random -import time import requests -from bs4 import BeautifulSoup from TaiwanLottery import utils class TaiwanLotteryCrawler(): - COUNT_OF_SUPER_LOTTERY_PRIZE_NUMBER = 6 - COUNT_OF_649_LOTTERY_PRIZE_NUMBER = 6 - COUNT_OF_DAILY_CASH_LOTTERY_PRIZE_NUMBER = 5 - COUNT_OF_1224_LOTTERY_PRIZE_NUMBER = 12 - COUNT_OF_3D_LOTTERY_PRIZE_NUMBER = 3 - COUNT_OF_4D_LOTTERY_PRIZE_NUMBER = 4 - COUNT_OF_38M6_LOTTERY_PRIZE_NUMBER = 6 - COUNT_OF_49M6_LOTTERY_PRIZE_NUMBER = 6 - COUNT_OF_39M5_LOTTERY_PRIZE_NUMBER = 5 - - html_parser = 'html.parser' - no_data = '查無資料' - - def initial_default_payload(self, url, payload, keys): - res = requests.get(url) - soup = BeautifulSoup(res.text, self.html_parser) - - for key in keys: - payload[key] = soup.select_one('#' + key)["value"] + NO_DATA = '查無資料' + BASE_URL = 'https://api.taiwanlottery.com/TLCAPIWeB/Lottery' + COUNT_OF_GROUP_1 = 6 + + def get_lottery_result(self, url): + response = requests.get(url) + return response.json() # 威力彩 - def super_lotto(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/SuperLotto638/history.aspx' - title = '威力彩_' + str(back_time[0]) + '_' + str(back_time[1]) + def super_lotto(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/SuperLotto638Result?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '威力彩_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + super_lotto638_result = result['content']['superLotto638Res'] datas = [] - payload = { - 'SuperLotto638Control_history1$chk': 'radYM', - 'SuperLotto638Control_history1$dropYear': back_time[0], - 'SuperLotto638Control_history1$dropMonth': back_time[1], - 'SuperLotto638Control_history1$btnSubmit': '查詢' - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center") - second_nums = soup.select(".td_w.font_red14b_center") - data_count = len(second_nums) / 2 - - for i in range(0, int(data_count)): - temp_second_nums = [] - stage = soup.select( - '#SuperLotto638Control_history1_dlQuery_DrawTerm_' + str(i)) - date = soup.select( - '#SuperLotto638Control_history1_dlQuery_Date_' + str(i)) - - for j in range(self.COUNT_OF_SUPER_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i * 2) * self.COUNT_OF_SUPER_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[0].text, - "開獎日期": date[0].text, - "第一區": temp_second_nums, - "第二區": second_nums[i * 2].text.strip() - } - datas.append(data) + + for i in range(total_size): + datas.append({ + "期別": super_lotto638_result[i]['period'], + "開獎日期": super_lotto638_result[i]['lotteryDate'], + "第一區": super_lotto638_result[i]['drawNumberSize'][0:self.COUNT_OF_GROUP_1], + "第二區": super_lotto638_result[i]['drawNumberSize'][self.COUNT_OF_GROUP_1] + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas # 大樂透 - def lotto649(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/Lotto649/history.aspx' - title = '大樂透_' + str(back_time[0]) + '_' + str(back_time[1]) + def lotto649(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/Lotto649Result?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '大樂透_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + lotto649_result = result['content']['lotto649Res'] datas = [] - payload = { - 'Lotto649Control_history$chk': 'radYM', - 'Lotto649Control_history$dropYear': back_time[0], - 'Lotto649Control_history$dropMonth': back_time[1], - 'Lotto649Control_history$btnSubmit': '查詢' - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center") - second_nums = soup.select(".td_w.font_red14b_center") - data_count = len(second_nums) / 2 - - for i in range(0, int(data_count)): - temp_second_nums = [] - stage = soup.select( - '#Lotto649Control_history_dlQuery_L649_DrawTerm_' + str(i)) - date = soup.select( - '#Lotto649Control_history_dlQuery_L649_DDate_' + str(i)) - - for j in range(self.COUNT_OF_649_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i * 2) * self.COUNT_OF_649_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[0].text, - "開獎日期": date[0].text, - "獎號": temp_second_nums, - "特別號": second_nums[i * 2].text.strip() - } - datas.append(data) + for i in range(total_size): + datas.append({ + "期別": lotto649_result[i]['period'], + "開獎日期": lotto649_result[i]['lotteryDate'], + "獎號": lotto649_result[i]['drawNumberSize'][0:self.COUNT_OF_GROUP_1], + "特別號": lotto649_result[i]['drawNumberSize'][self.COUNT_OF_GROUP_1] + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas - # 今彩539 - def daily_cash(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/Dailycash/history.aspx' - title = '今彩539_' + str(back_time[0]) + '_' + str(back_time[1]) + # # 今彩539 + def daily_cash(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/Daily539Result?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '今彩539_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + daily539_result = result['content']['daily539Res'] datas = [] - payload = { - 'D539Control_history1$chk': 'radYM', - 'D539Control_history1$dropYear': back_time[0], - 'D539Control_history1$dropMonth': back_time[1], - 'D539Control_history1$btnSubmit': '查詢' - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center") - data_count = len(first_nums) / self.COUNT_OF_DAILY_CASH_LOTTERY_PRIZE_NUMBER / 2 - - for i in range(0, int(data_count)): - temp_second_nums = [] - stage = soup.select( - '#D539Control_history1_dlQuery_D539_DrawTerm_' + str(i)) - date = soup.select( - '#D539Control_history1_dlQuery_D539_DDate_' + str(i)) - - for j in range(self.COUNT_OF_DAILY_CASH_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i * 2) * self.COUNT_OF_DAILY_CASH_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[0].text, - "開獎日期": date[0].text, - "獎號": temp_second_nums, - } - datas.append(data) + + for i in range(total_size): + datas.append({ + "期別": daily539_result[i]['period'], + "開獎日期": daily539_result[i]['lotteryDate'], + "獎號": daily539_result[i]['drawNumberSize'], + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas - # 雙贏彩 - def lotto1224(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/Lotto1224/history.aspx' - title = '雙贏彩_' + str(back_time[0]) + '_' + str(back_time[1]) + # # 雙贏彩 + def lotto1224(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/Lotto1224Result?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '雙贏彩_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + lotto1224_result = result['content']['lotto1224Res'] datas = [] - payload = { - 'Lotto1224Control_history$chk': 'radYM', - 'Lotto1224Control_history$dropYear': back_time[0], - 'Lotto1224Control_history$dropMonth': back_time[1], - 'Lotto1224Control_history$btnSubmit': '查詢' - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center") - data_count = len(first_nums) / 2 / self.COUNT_OF_1224_LOTTERY_PRIZE_NUMBER - - for i in range(0, int(data_count)): - temp_second_nums = [] - stage = soup.select( - '#Lotto1224Control_history_dlQuery_Lotto1224_DrawTerm_' + str(i)) - date = soup.select( - '#Lotto1224Control_history_dlQuery_Lotto1224_DDate_' + str(i)) - - for j in range(self.COUNT_OF_1224_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i * 2) * self.COUNT_OF_1224_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[0].text, - "開獎日期": date[0].text, - "獎號": temp_second_nums, - } - datas.append(data) + + for i in range(total_size): + datas.append({ + "期別": lotto1224_result[i]['period'], + "開獎日期": lotto1224_result[i]['lotteryDate'], + "獎號": lotto1224_result[i]['drawNumberSize'], + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas - # 3星彩 - def lotto3d(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/3D/history.aspx' - title = '3星彩_' + str(back_time[0]) + '_' + str(back_time[1]) + # # 3星彩 + def lotto3d(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/3DHistoryResult?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '3星彩_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + lotto_3d_history_result = result['content']['lotto3DHistoryRes'] datas = [] - payload = { - 'L3DControl_history1$chk': 'radYM', - 'L3DControl_history1$dropYear': back_time[0], - 'L3DControl_history1$dropMonth': back_time[1], - 'L3DControl_history1$btnSubmit': '查詢' - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center") - data_count = len(first_nums) / self.COUNT_OF_3D_LOTTERY_PRIZE_NUMBER - stage = soup.select('table[class*="table_"] > tr:nth-child(3) > td:nth-child(1)') - date = soup.select('table[class*="table_"] > tr:nth-child(3) > td:nth-child(2) > p') - - for i in range(0, int(data_count)): - temp_second_nums = [] - for j in range(self.COUNT_OF_3D_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i) * self.COUNT_OF_3D_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[i].text, - "開獎日期": date[i].text.replace('開獎', ''), - "獎號": temp_second_nums, - } - datas.append(data) + for i in range(total_size): + datas.append({ + "期別": lotto_3d_history_result[i]['period'], + "開獎日期": lotto_3d_history_result[i]['lotteryDate'], + "獎號": lotto_3d_history_result[i]['drawNumberAppear'], + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas # 4星彩 - def lotto4d(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/4D/history.aspx' - title = '4星彩_' + str(back_time[0]) + '_' + str(back_time[1]) + def lotto4d(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/4DHistoryResult?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '4星彩_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + lotto_4d_history_result = result['content']['lotto4DHistoryRes'] datas = [] - payload = { - 'L4DControl_history1$chk': 'radYM', - 'L4DControl_history1$dropYear': back_time[0], - 'L4DControl_history1$dropMonth': back_time[1], - 'L4DControl_history1$btnSubmit': '查詢' - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center > span.td_w") - data_count = len(first_nums) / self.COUNT_OF_4D_LOTTERY_PRIZE_NUMBER - stage = soup.select('table[class*="table_"] > tr:nth-child(3) > td:nth-child(1)') - date = soup.select('table[class*="table_"] > tr:nth-child(3) > td:nth-child(2) > p') - for i in range(0, int(data_count)): - temp_second_nums = [] - - for j in range(self.COUNT_OF_4D_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i) * self.COUNT_OF_4D_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[i].text, - "開獎日期": date[i].text.replace('開獎', ''), - "獎號": temp_second_nums, - } - datas.append(data) + for i in range(total_size): + datas.append({ + "期別": lotto_4d_history_result[i]['period'], + "開獎日期": lotto_4d_history_result[i]['lotteryDate'], + "獎號": lotto_4d_history_result[i]['drawNumberAppear'], + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas # 38樂合彩 - def lotto38m6(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/38m6/history.aspx' - title = '38樂合彩_' + str(back_time[0]) + '_' + str(back_time[1]) + def lotto38m6(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/38M6Result?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '38樂合彩_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + m638_result = result['content']['m638Res'] datas = [] - payload = { - 'M638Control_history1$chk': 'radYM', - 'M638Control_history1$dropYear': back_time[0], - 'M638Control_history1$dropMonth': back_time[1], - 'M638Control_history1$btnSubmit': '查詢', - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION', '__VIEWSTATEENCRYPTED']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center > span") - data_count = len(first_nums) / self.COUNT_OF_38M6_LOTTERY_PRIZE_NUMBER / 2 - - for i in range(0, int(data_count)): - temp_second_nums = [] - stage = soup.select( - '#M638Control_history1_dlQuery_lbM638_DrawTerm_' + str(i)) - date = soup.select( - '#M638Control_history1_dlQuery_M638_DDate_' + str(i)) - - for j in range(self.COUNT_OF_38M6_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i * 2) * self.COUNT_OF_38M6_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[0].text, - "開獎日期": date[0].text, - "獎號": temp_second_nums, - } - datas.append(data) + + for i in range(total_size): + datas.append({ + "期別": m638_result[i]['period'], + "開獎日期": m638_result[i]['lotteryDate'], + "獎號": m638_result[i]['drawNumberSize'], + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas # 49樂合彩 - def lotto49m6(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/49m6/history.aspx' - title = '49樂合彩_' + str(back_time[0]) + '_' + str(back_time[1]) + def lotto49m6(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/49M6Result?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '49樂合彩_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + m649_result = result['content']['m649Res'] datas = [] - payload = { - 'M649Control_history1$chk': 'radYM', - 'M649Control_history1$dropYear': back_time[0], - 'M649Control_history1$dropMonth': back_time[1], - 'M649Control_history1$btnSubmit': '查詢', - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION', '__VIEWSTATEENCRYPTED']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center > span") - data_count = len(first_nums) / self.COUNT_OF_49M6_LOTTERY_PRIZE_NUMBER / 2 - - for i in range(0, int(data_count)): - temp_second_nums = [] - stage = soup.select( - '#M649Control_history1_dlQuery_M649_DrawTerm_' + str(i)) - date = soup.select( - '#M649Control_history1_dlQuery_M649_DDate_' + str(i)) - - for j in range(self.COUNT_OF_38M6_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i * 2) * self.COUNT_OF_49M6_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[0].text, - "開獎日期": date[0].text, - "獎號": temp_second_nums, - } - datas.append(data) + + for i in range(total_size): + datas.append({ + "期別": m649_result[i]['period'], + "開獎日期": m649_result[i]['lotteryDate'], + "獎號": m649_result[i]['drawNumberSize'], + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas # 39樂合彩 - def lotto39m5(self, back_time=[utils.get_current_republic_era(), utils.get_current_month()]): - URL = 'https://www.taiwanlottery.com.tw/Lotto/39m5/history.aspx' - title = '39樂合彩_' + str(back_time[0]) + '_' + str(back_time[1]) + def lotto39m5(self, back_time=[utils.get_current_year(), utils.get_current_month()]): + URL = "{}/39M5Result?period&month={}-{}&pageSize=31".format(self.BASE_URL, back_time[0], back_time[1]) + title = '39樂合彩_' + str(back_time[0]) + '_' + str(back_time[1]) + result = self.get_lottery_result(URL) + total_size = result['content']['totalSize'] + m539_result = result['content']['m539Res'] datas = [] - payload = { - 'M539Control_history1$chk': 'radYM', - 'M539Control_history1$dropYear': back_time[0], - 'M539Control_history1$dropMonth': back_time[1], - 'M539Control_history1$btnSubmit': '查詢', - } - - self.initial_default_payload(URL, payload, ['__VIEWSTATE', '__VIEWSTATEGENERATOR', '__EVENTVALIDATION', '__VIEWSTATEENCRYPTED']) - - res = requests.post(URL, data=payload) - soup = BeautifulSoup(res.text, self.html_parser) - if (self.no_data in res.text): - logging.warning(self.no_data + title) - return - - first_nums = soup.select(".td_w.font_black14b_center > span") - data_count = len(first_nums) / self.COUNT_OF_39M5_LOTTERY_PRIZE_NUMBER / 2 - - stage = soup.select('table[class*="table_"] tr:nth-child(2) > td:nth-child(1) > span') - date = soup.select('table[class*="table_"] tr:nth-child(2) > td:nth-child(2) > span > span') - - for i in range(0, int(data_count)): - temp_second_nums = [] - - for j in range(self.COUNT_OF_39M5_LOTTERY_PRIZE_NUMBER): - temp_second_nums.append(first_nums[((i * 2) * self.COUNT_OF_39M5_LOTTERY_PRIZE_NUMBER) + j].text.strip()) - - data = { - "期別": stage[i].text, - "開獎日期": date[i].text, - "獎號": temp_second_nums, - } - datas.append(data) + for i in range(total_size): + datas.append({ + "期別": m539_result[i]['period'], + "開獎日期": m539_result[i]['lotteryDate'], + "獎號": m539_result[i]['drawNumberSize'], + }) if len(datas) == 0: - logging.warning(self.no_data + title) - return + logging.warning(self.NO_DATA + title) return datas - - # 威力彩歷史查詢 - def super_lotto_back(self, back_month='0'): - for i in range(int(back_month), -1, -1): - time.sleep(random.random()) - self.super_lotto(utils.month_diff(i)) - logging.debug(str(utils.month_diff(i)[0]) + '_' + str(utils.month_diff(i)[1])) - - # 大樂透歷史查詢 - def lotto649_back(self, back_month='0'): - for i in range(int(back_month), -1, -1): - time.sleep(random.random()) - self.lotto649(utils.month_diff(i)) - logging.debug(str(utils.month_diff(i)[0]) + '_' + str(utils.month_diff(i)[1])) - - # 今彩539歷史查詢 - def daily_cash_back(self, back_month='0'): - for i in range(int(back_month), -1, -1): - time.sleep(random.random()) - self.daily_cash(utils.month_diff(i)) - logging.debug(str(utils.month_diff(i)[0]) + '_' + str(utils.month_diff(i)[1])) - - # 雙贏彩歷史查詢 - def lotto1224_back(self, back_month='0'): - for i in range(int(back_month), -1, -1): - time.sleep(random.random()) - self.lotto1224(utils.month_diff(i)) - logging.debug(str(utils.month_diff(i)[0]) + '_' + str(utils.month_diff(i)[1])) diff --git a/TaiwanLottery/utils.py b/TaiwanLottery/utils.py index c53adcb..3f75270 100644 --- a/TaiwanLottery/utils.py +++ b/TaiwanLottery/utils.py @@ -9,13 +9,12 @@ # 取得目前月份 def get_current_month(): - return datetime.datetime.now().month + return datetime.datetime.now().strftime('%m') -# 取得目前民國年分 -def get_current_republic_era(): - current_time = datetime.datetime.now() - return current_time.year - 1911 +# 取得目前年 +def get_current_year(): + return datetime.datetime.now().strftime('%Y') # 西元年月份轉民國年月份 diff --git a/requirements.txt b/requirements.txt index 329bb68..9489421 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/setup.cfg b/setup.cfg index 47e29d8..e64555d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,6 @@ classifiers = [options] install_requires = requests>=2 - beautifulsoup4>=4 terminaltables>=3 python_requires = >=3.6 diff --git a/setup.py b/setup.py index 969d50f..5d9d824 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,6 @@ packages=find_packages(), install_requires=[ "requests>=2", - "beautifulsoup4>=4", "terminaltables>=3", "pytest>=7.0", "pytest-cov>=4.0", diff --git a/tests/test_lottery.py b/tests/test_lottery.py index 8f26cac..be61e7f 100644 --- a/tests/test_lottery.py +++ b/tests/test_lottery.py @@ -7,19 +7,19 @@ def test_super_lotto(): lottery = TaiwanLotteryCrawler() # When user get the 威力彩 2023-06 result without print and output to json - super_lotto_result = lottery.super_lotto([112, 6]) + super_lotto_result = lottery.super_lotto(['2023', '06']) # Then the super_lotto_result should be equal to test result assert super_lotto_result == [ - {'期別': '112000052', '開獎日期': '112/06/29', '第一區': ['36', '27', '26', '29', '08', '01'], '第二區': '02'}, - {'期別': '112000051', '開獎日期': '112/06/26', '第一區': ['16', '01', '15', '24', '17', '35'], '第二區': '06'}, - {'期別': '112000050', '開獎日期': '112/06/22', '第一區': ['24', '28', '04', '01', '17', '07'], '第二區': '08'}, - {'期別': '112000049', '開獎日期': '112/06/19', '第一區': ['20', '12', '36', '08', '04', '27'], '第二區': '01'}, - {'期別': '112000048', '開獎日期': '112/06/15', '第一區': ['24', '02', '34', '36', '25', '26'], '第二區': '08'}, - {'期別': '112000047', '開獎日期': '112/06/12', '第一區': ['38', '35', '16', '18', '01', '02'], '第二區': '01'}, - {'期別': '112000046', '開獎日期': '112/06/08', '第一區': ['08', '35', '38', '18', '03', '12'], '第二區': '03'}, - {'期別': '112000045', '開獎日期': '112/06/05', '第一區': ['34', '35', '11', '04', '28', '32'], '第二區': '01'}, - {'期別': '112000044', '開獎日期': '112/06/01', '第一區': ['29', '37', '10', '25', '18', '36'], '第二區': '02'} + {'期別': 112000052, '開獎日期': '2023-06-29T00:00:00', '第一區': [1, 8, 26, 27, 29, 36], '第二區': 2}, + {'期別': 112000051, '開獎日期': '2023-06-26T00:00:00', '第一區': [1, 15, 16, 17, 24, 35], '第二區': 6}, + {'期別': 112000050, '開獎日期': '2023-06-22T00:00:00', '第一區': [1, 4, 7, 17, 24, 28], '第二區': 8}, + {'期別': 112000049, '開獎日期': '2023-06-19T00:00:00', '第一區': [4, 8, 12, 20, 27, 36], '第二區': 1}, + {'期別': 112000048, '開獎日期': '2023-06-15T00:00:00', '第一區': [2, 24, 25, 26, 34, 36], '第二區': 8}, + {'期別': 112000047, '開獎日期': '2023-06-12T00:00:00', '第一區': [1, 2, 16, 18, 35, 38], '第二區': 1}, + {'期別': 112000046, '開獎日期': '2023-06-08T00:00:00', '第一區': [3, 8, 12, 18, 35, 38], '第二區': 3}, + {'期別': 112000045, '開獎日期': '2023-06-05T00:00:00', '第一區': [4, 11, 28, 32, 34, 35], '第二區': 1}, + {'期別': 112000044, '開獎日期': '2023-06-01T00:00:00', '第一區': [10, 18, 25, 29, 36, 37], '第二區': 2} ] @@ -28,19 +28,19 @@ def test_lotto649(): lottery = TaiwanLotteryCrawler() # When user get the 大樂透 2023-06 result without print and output to json - lotto649_result = lottery.lotto649([112, 6]) + lotto649_result = lottery.lotto649(['2023', '06']) # Then the lotto649_result should be equal to test result assert lotto649_result == [ - {'期別': '112000064', '開獎日期': '112/06/30', '獎號': ['26', '06', '22', '29', '32', '43'], '特別號': '38'}, - {'期別': '112000063', '開獎日期': '112/06/27', '獎號': ['13', '30', '37', '43', '44', '24'], '特別號': '04'}, - {'期別': '112000062', '開獎日期': '112/06/23', '獎號': ['23', '31', '08', '49', '42', '04'], '特別號': '16'}, - {'期別': '112000061', '開獎日期': '112/06/20', '獎號': ['41', '32', '15', '37', '05', '34'], '特別號': '11'}, - {'期別': '112000060', '開獎日期': '112/06/16', '獎號': ['02', '30', '21', '33', '41', '22'], '特別號': '42'}, - {'期別': '112000059', '開獎日期': '112/06/13', '獎號': ['09', '21', '08', '01', '10', '06'], '特別號': '02'}, - {'期別': '112000058', '開獎日期': '112/06/09', '獎號': ['46', '38', '49', '36', '32', '30'], '特別號': '26'}, - {'期別': '112000057', '開獎日期': '112/06/06', '獎號': ['30', '43', '27', '41', '13', '08'], '特別號': '18'}, - {'期別': '112000056', '開獎日期': '112/06/02', '獎號': ['13', '05', '34', '01', '23', '16'], '特別號': '49'} + {'期別': 112000064, '開獎日期': '2023-06-30T00:00:00', '獎號': [6, 22, 26, 29, 32, 43], '特別號': 38}, + {'期別': 112000063, '開獎日期': '2023-06-27T00:00:00', '獎號': [13, 24, 30, 37, 43, 44], '特別號': 4}, + {'期別': 112000062, '開獎日期': '2023-06-23T00:00:00', '獎號': [4, 8, 23, 31, 42, 49], '特別號': 16}, + {'期別': 112000061, '開獎日期': '2023-06-20T00:00:00', '獎號': [5, 15, 32, 34, 37, 41], '特別號': 11}, + {'期別': 112000060, '開獎日期': '2023-06-16T00:00:00', '獎號': [2, 21, 22, 30, 33, 41], '特別號': 42}, + {'期別': 112000059, '開獎日期': '2023-06-13T00:00:00', '獎號': [1, 6, 8, 9, 10, 21], '特別號': 2}, + {'期別': 112000058, '開獎日期': '2023-06-09T00:00:00', '獎號': [30, 32, 36, 38, 46, 49], '特別號': 26}, + {'期別': 112000057, '開獎日期': '2023-06-06T00:00:00', '獎號': [8, 13, 27, 30, 41, 43], '特別號': 18}, + {'期別': 112000056, '開獎日期': '2023-06-02T00:00:00', '獎號': [1, 5, 13, 16, 23, 34], '特別號': 49} ] @@ -49,36 +49,36 @@ def test_daily_cash(): lottery = TaiwanLotteryCrawler() # When user get the 今彩539 2023-06 result without print and output to json - daily_cash_result = lottery.daily_cash([112, 6]) + daily_cash_result = lottery.daily_cash(['2023', '06']) # Then the daily_cash_result should be equal to test result assert daily_cash_result == [ - {'期別': '112000155', '開獎日期': '112/06/30', '獎號': ['36', '03', '20', '11', '30']}, - {'期別': '112000154', '開獎日期': '112/06/29', '獎號': ['17', '14', '27', '10', '02']}, - {'期別': '112000153', '開獎日期': '112/06/28', '獎號': ['08', '32', '05', '21', '33']}, - {'期別': '112000152', '開獎日期': '112/06/27', '獎號': ['39', '28', '14', '12', '04']}, - {'期別': '112000151', '開獎日期': '112/06/26', '獎號': ['05', '26', '20', '15', '14']}, - {'期別': '112000150', '開獎日期': '112/06/24', '獎號': ['13', '10', '07', '14', '22']}, - {'期別': '112000149', '開獎日期': '112/06/23', '獎號': ['24', '30', '20', '11', '13']}, - {'期別': '112000148', '開獎日期': '112/06/22', '獎號': ['33', '34', '06', '10', '39']}, - {'期別': '112000147', '開獎日期': '112/06/21', '獎號': ['23', '30', '09', '38', '02']}, - {'期別': '112000146', '開獎日期': '112/06/20', '獎號': ['25', '34', '11', '27', '37']}, - {'期別': '112000145', '開獎日期': '112/06/19', '獎號': ['36', '13', '01', '33', '39']}, - {'期別': '112000144', '開獎日期': '112/06/17', '獎號': ['36', '29', '09', '02', '20']}, - {'期別': '112000143', '開獎日期': '112/06/16', '獎號': ['09', '24', '39', '12', '28']}, - {'期別': '112000142', '開獎日期': '112/06/15', '獎號': ['18', '15', '21', '02', '11']}, - {'期別': '112000141', '開獎日期': '112/06/14', '獎號': ['06', '21', '34', '32', '01']}, - {'期別': '112000140', '開獎日期': '112/06/13', '獎號': ['29', '36', '37', '34', '24']}, - {'期別': '112000139', '開獎日期': '112/06/12', '獎號': ['13', '26', '08', '19', '22']}, - {'期別': '112000138', '開獎日期': '112/06/10', '獎號': ['19', '09', '08', '28', '01']}, - {'期別': '112000137', '開獎日期': '112/06/09', '獎號': ['15', '02', '17', '29', '13']}, - {'期別': '112000136', '開獎日期': '112/06/08', '獎號': ['15', '38', '12', '01', '23']}, - {'期別': '112000135', '開獎日期': '112/06/07', '獎號': ['11', '07', '08', '29', '03']}, - {'期別': '112000134', '開獎日期': '112/06/06', '獎號': ['11', '37', '29', '18', '26']}, - {'期別': '112000133', '開獎日期': '112/06/05', '獎號': ['20', '16', '05', '01', '29']}, - {'期別': '112000132', '開獎日期': '112/06/03', '獎號': ['23', '13', '03', '07', '34']}, - {'期別': '112000131', '開獎日期': '112/06/02', '獎號': ['04', '09', '08', '37', '22']}, - {'期別': '112000130', '開獎日期': '112/06/01', '獎號': ['25', '08', '27', '34', '18']} + {'期別': 112000155, '開獎日期': '2023-06-30T00:00:00', '獎號': [3, 11, 20, 30, 36]}, + {'期別': 112000154, '開獎日期': '2023-06-29T00:00:00', '獎號': [2, 10, 14, 17, 27]}, + {'期別': 112000153, '開獎日期': '2023-06-28T00:00:00', '獎號': [5, 8, 21, 32, 33]}, + {'期別': 112000152, '開獎日期': '2023-06-27T00:00:00', '獎號': [4, 12, 14, 28, 39]}, + {'期別': 112000151, '開獎日期': '2023-06-26T00:00:00', '獎號': [5, 14, 15, 20, 26]}, + {'期別': 112000150, '開獎日期': '2023-06-24T00:00:00', '獎號': [7, 10, 13, 14, 22]}, + {'期別': 112000149, '開獎日期': '2023-06-23T00:00:00', '獎號': [11, 13, 20, 24, 30]}, + {'期別': 112000148, '開獎日期': '2023-06-22T00:00:00', '獎號': [6, 10, 33, 34, 39]}, + {'期別': 112000147, '開獎日期': '2023-06-21T00:00:00', '獎號': [2, 9, 23, 30, 38]}, + {'期別': 112000146, '開獎日期': '2023-06-20T00:00:00', '獎號': [11, 25, 27, 34, 37]}, + {'期別': 112000145, '開獎日期': '2023-06-19T00:00:00', '獎號': [1, 13, 33, 36, 39]}, + {'期別': 112000144, '開獎日期': '2023-06-17T00:00:00', '獎號': [2, 9, 20, 29, 36]}, + {'期別': 112000143, '開獎日期': '2023-06-16T00:00:00', '獎號': [9, 12, 24, 28, 39]}, + {'期別': 112000142, '開獎日期': '2023-06-15T00:00:00', '獎號': [2, 11, 15, 18, 21]}, + {'期別': 112000141, '開獎日期': '2023-06-14T00:00:00', '獎號': [1, 6, 21, 32, 34]}, + {'期別': 112000140, '開獎日期': '2023-06-13T00:00:00', '獎號': [24, 29, 34, 36, 37]}, + {'期別': 112000139, '開獎日期': '2023-06-12T00:00:00', '獎號': [8, 13, 19, 22, 26]}, + {'期別': 112000138, '開獎日期': '2023-06-10T00:00:00', '獎號': [1, 8, 9, 19, 28]}, + {'期別': 112000137, '開獎日期': '2023-06-09T00:00:00', '獎號': [2, 13, 15, 17, 29]}, + {'期別': 112000136, '開獎日期': '2023-06-08T00:00:00', '獎號': [1, 12, 15, 23, 38]}, + {'期別': 112000135, '開獎日期': '2023-06-07T00:00:00', '獎號': [3, 7, 8, 11, 29]}, + {'期別': 112000134, '開獎日期': '2023-06-06T00:00:00', '獎號': [11, 18, 26, 29, 37]}, + {'期別': 112000133, '開獎日期': '2023-06-05T00:00:00', '獎號': [1, 5, 16, 20, 29]}, + {'期別': 112000132, '開獎日期': '2023-06-03T00:00:00', '獎號': [3, 7, 13, 23, 34]}, + {'期別': 112000131, '開獎日期': '2023-06-02T00:00:00', '獎號': [4, 8, 9, 22, 37]}, + {'期別': 112000130, '開獎日期': '2023-06-01T00:00:00', '獎號': [8, 18, 25, 27, 34]} ] @@ -87,36 +87,36 @@ def test_lotto1224(): lottery = TaiwanLotteryCrawler() # When user get the 雙贏彩 2023-06 result without print and output to json - lotto1224_result = lottery.lotto1224([112, 6]) + lotto1224_result = lottery.lotto1224(['2023', '06']) # Then the lotto1224_result should be equal to test result assert lotto1224_result == [ - {'期別': '112000155', '開獎日期': '112/06/30', '獎號': ['15', '20', '16', '02', '06', '24', '01', '10', '07', '12', '05', '14']}, - {'期別': '112000154', '開獎日期': '112/06/29', '獎號': ['05', '01', '12', '23', '06', '08', '02', '19', '04', '13', '24', '11']}, - {'期別': '112000153', '開獎日期': '112/06/28', '獎號': ['05', '21', '06', '19', '08', '10', '24', '13', '07', '04', '09', '23']}, - {'期別': '112000152', '開獎日期': '112/06/27', '獎號': ['08', '10', '09', '04', '07', '01', '24', '15', '22', '13', '16', '02']}, - {'期別': '112000151', '開獎日期': '112/06/26', '獎號': ['15', '04', '10', '17', '24', '05', '21', '07', '06', '18', '23', '16']}, - {'期別': '112000150', '開獎日期': '112/06/24', '獎號': ['20', '17', '15', '14', '22', '18', '01', '16', '19', '09', '05', '08']}, - {'期別': '112000149', '開獎日期': '112/06/23', '獎號': ['13', '12', '19', '04', '05', '03', '23', '16', '06', '10', '22', '20']}, - {'期別': '112000148', '開獎日期': '112/06/22', '獎號': ['23', '17', '04', '03', '19', '12', '14', '13', '09', '18', '21', '06']}, - {'期別': '112000147', '開獎日期': '112/06/21', '獎號': ['01', '07', '19', '13', '14', '12', '24', '23', '18', '10', '03', '22']}, - {'期別': '112000146', '開獎日期': '112/06/20', '獎號': ['01', '14', '23', '19', '05', '04', '07', '10', '03', '02', '18', '06']}, - {'期別': '112000145', '開獎日期': '112/06/19', '獎號': ['23', '09', '24', '22', '17', '04', '06', '16', '19', '03', '07', '11']}, - {'期別': '112000144', '開獎日期': '112/06/17', '獎號': ['08', '24', '13', '05', '02', '11', '04', '01', '20', '09', '16', '21']}, - {'期別': '112000143', '開獎日期': '112/06/16', '獎號': ['12', '14', '18', '09', '19', '08', '21', '22', '01', '23', '11', '03']}, - {'期別': '112000142', '開獎日期': '112/06/15', '獎號': ['18', '08', '02', '22', '09', '20', '24', '15', '19', '21', '04', '13']}, - {'期別': '112000141', '開獎日期': '112/06/14', '獎號': ['20', '18', '03', '06', '24', '19', '12', '23', '10', '13', '02', '04']}, - {'期別': '112000140', '開獎日期': '112/06/13', '獎號': ['02', '04', '23', '09', '10', '22', '16', '06', '24', '03', '21', '07']}, - {'期別': '112000139', '開獎日期': '112/06/12', '獎號': ['23', '24', '12', '01', '04', '09', '15', '02', '07', '03', '16', '06']}, - {'期別': '112000138', '開獎日期': '112/06/10', '獎號': ['17', '01', '23', '24', '12', '20', '08', '09', '18', '21', '15', '22']}, - {'期別': '112000137', '開獎日期': '112/06/09', '獎號': ['08', '09', '22', '16', '23', '05', '12', '20', '19', '10', '13', '04']}, - {'期別': '112000136', '開獎日期': '112/06/08', '獎號': ['07', '17', '05', '10', '24', '12', '04', '08', '03', '02', '22', '19']}, - {'期別': '112000135', '開獎日期': '112/06/07', '獎號': ['03', '02', '11', '23', '21', '07', '19', '01', '08', '14', '04', '09']}, - {'期別': '112000134', '開獎日期': '112/06/06', '獎號': ['02', '10', '12', '17', '21', '09', '24', '19', '13', '11', '16', '22']}, - {'期別': '112000133', '開獎日期': '112/06/05', '獎號': ['23', '02', '15', '19', '12', '06', '20', '14', '21', '08', '17', '03']}, - {'期別': '112000132', '開獎日期': '112/06/03', '獎號': ['05', '20', '22', '11', '23', '01', '15', '13', '16', '07', '14', '12']}, - {'期別': '112000131', '開獎日期': '112/06/02', '獎號': ['08', '12', '24', '01', '07', '15', '11', '18', '19', '06', '21', '14']}, - {'期別': '112000130', '開獎日期': '112/06/01', '獎號': ['23', '17', '10', '14', '20', '03', '05', '09', '15', '12', '07', '19']} + {'期別': 112000155, '開獎日期': '2023-06-30T00:00:00', '獎號': [1, 2, 5, 6, 7, 10, 12, 14, 15, 16, 20, 24]}, + {'期別': 112000154, '開獎日期': '2023-06-29T00:00:00', '獎號': [1, 2, 4, 5, 6, 8, 11, 12, 13, 19, 23, 24]}, + {'期別': 112000153, '開獎日期': '2023-06-28T00:00:00', '獎號': [4, 5, 6, 7, 8, 9, 10, 13, 19, 21, 23, 24]}, + {'期別': 112000152, '開獎日期': '2023-06-27T00:00:00', '獎號': [1, 2, 4, 7, 8, 9, 10, 13, 15, 16, 22, 24]}, + {'期別': 112000151, '開獎日期': '2023-06-26T00:00:00', '獎號': [4, 5, 6, 7, 10, 15, 16, 17, 18, 21, 23, 24]}, + {'期別': 112000150, '開獎日期': '2023-06-24T00:00:00', '獎號': [1, 5, 8, 9, 14, 15, 16, 17, 18, 19, 20, 22]}, + {'期別': 112000149, '開獎日期': '2023-06-23T00:00:00', '獎號': [3, 4, 5, 6, 10, 12, 13, 16, 19, 20, 22, 23]}, + {'期別': 112000148, '開獎日期': '2023-06-22T00:00:00', '獎號': [3, 4, 6, 9, 12, 13, 14, 17, 18, 19, 21, 23]}, + {'期別': 112000147, '開獎日期': '2023-06-21T00:00:00', '獎號': [1, 3, 7, 10, 12, 13, 14, 18, 19, 22, 23, 24]}, + {'期別': 112000146, '開獎日期': '2023-06-20T00:00:00', '獎號': [1, 2, 3, 4, 5, 6, 7, 10, 14, 18, 19, 23]}, + {'期別': 112000145, '開獎日期': '2023-06-19T00:00:00', '獎號': [3, 4, 6, 7, 9, 11, 16, 17, 19, 22, 23, 24]}, + {'期別': 112000144, '開獎日期': '2023-06-17T00:00:00', '獎號': [1, 2, 4, 5, 8, 9, 11, 13, 16, 20, 21, 24]}, + {'期別': 112000143, '開獎日期': '2023-06-16T00:00:00', '獎號': [1, 3, 8, 9, 11, 12, 14, 18, 19, 21, 22, 23]}, + {'期別': 112000142, '開獎日期': '2023-06-15T00:00:00', '獎號': [2, 4, 8, 9, 13, 15, 18, 19, 20, 21, 22, 24]}, + {'期別': 112000141, '開獎日期': '2023-06-14T00:00:00', '獎號': [2, 3, 4, 6, 10, 12, 13, 18, 19, 20, 23, 24]}, + {'期別': 112000140, '開獎日期': '2023-06-13T00:00:00', '獎號': [2, 3, 4, 6, 7, 9, 10, 16, 21, 22, 23, 24]}, + {'期別': 112000139, '開獎日期': '2023-06-12T00:00:00', '獎號': [1, 2, 3, 4, 6, 7, 9, 12, 15, 16, 23, 24]}, + {'期別': 112000138, '開獎日期': '2023-06-10T00:00:00', '獎號': [1, 8, 9, 12, 15, 17, 18, 20, 21, 22, 23, 24]}, + {'期別': 112000137, '開獎日期': '2023-06-09T00:00:00', '獎號': [4, 5, 8, 9, 10, 12, 13, 16, 19, 20, 22, 23]}, + {'期別': 112000136, '開獎日期': '2023-06-08T00:00:00', '獎號': [2, 3, 4, 5, 7, 8, 10, 12, 17, 19, 22, 24]}, + {'期別': 112000135, '開獎日期': '2023-06-07T00:00:00', '獎號': [1, 2, 3, 4, 7, 8, 9, 11, 14, 19, 21, 23]}, + {'期別': 112000134, '開獎日期': '2023-06-06T00:00:00', '獎號': [2, 9, 10, 11, 12, 13, 16, 17, 19, 21, 22, 24]}, + {'期別': 112000133, '開獎日期': '2023-06-05T00:00:00', '獎號': [2, 3, 6, 8, 12, 14, 15, 17, 19, 20, 21, 23]}, + {'期別': 112000132, '開獎日期': '2023-06-03T00:00:00', '獎號': [1, 5, 7, 11, 12, 13, 14, 15, 16, 20, 22, 23]}, + {'期別': 112000131, '開獎日期': '2023-06-02T00:00:00', '獎號': [1, 6, 7, 8, 11, 12, 14, 15, 18, 19, 21, 24]}, + {'期別': 112000130, '開獎日期': '2023-06-01T00:00:00', '獎號': [3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 23]} ] @@ -125,36 +125,38 @@ def test_lotto3d(): lottery = TaiwanLotteryCrawler() # When user get the 3星彩 2023-08 result without print and output to json - lotto3d_result = lottery.lotto3d([112, 8]) + lotto3d_result = lottery.lotto3d(['2023', '08']) + + print(lotto3d_result) assert lotto3d_result == [ - {'期別': '112000208', '開獎日期': '112/8/31', '獎號': ['7', '2', '7']}, - {'期別': '112000207', '開獎日期': '112/8/30', '獎號': ['9', '0', '1']}, - {'期別': '112000206', '開獎日期': '112/8/29', '獎號': ['1', '5', '9']}, - {'期別': '112000205', '開獎日期': '112/8/28', '獎號': ['5', '6', '6']}, - {'期別': '112000204', '開獎日期': '112/8/26', '獎號': ['5', '8', '0']}, - {'期別': '112000203', '開獎日期': '112/8/25', '獎號': ['9', '7', '1']}, - {'期別': '112000202', '開獎日期': '112/8/24', '獎號': ['7', '0', '4']}, - {'期別': '112000201', '開獎日期': '112/8/23', '獎號': ['6', '3', '2']}, - {'期別': '112000200', '開獎日期': '112/8/22', '獎號': ['1', '5', '2']}, - {'期別': '112000199', '開獎日期': '112/8/21', '獎號': ['0', '9', '7']}, - {'期別': '112000198', '開獎日期': '112/8/19', '獎號': ['7', '4', '3']}, - {'期別': '112000197', '開獎日期': '112/8/18', '獎號': ['9', '8', '6']}, - {'期別': '112000196', '開獎日期': '112/8/17', '獎號': ['2', '7', '7']}, - {'期別': '112000195', '開獎日期': '112/8/16', '獎號': ['3', '1', '6']}, - {'期別': '112000194', '開獎日期': '112/8/15', '獎號': ['6', '4', '8']}, - {'期別': '112000193', '開獎日期': '112/8/14', '獎號': ['8', '9', '5']}, - {'期別': '112000192', '開獎日期': '112/8/12', '獎號': ['2', '1', '5']}, - {'期別': '112000191', '開獎日期': '112/8/11', '獎號': ['6', '1', '7']}, - {'期別': '112000190', '開獎日期': '112/8/10', '獎號': ['2', '7', '2']}, - {'期別': '112000189', '開獎日期': '112/8/9', '獎號': ['6', '8', '6']}, - {'期別': '112000188', '開獎日期': '112/8/8', '獎號': ['8', '0', '5']}, - {'期別': '112000187', '開獎日期': '112/8/7', '獎號': ['1', '2', '7']}, - {'期別': '112000186', '開獎日期': '112/8/5', '獎號': ['4', '7', '2']}, - {'期別': '112000185', '開獎日期': '112/8/4', '獎號': ['5', '0', '4']}, - {'期別': '112000184', '開獎日期': '112/8/3', '獎號': ['7', '4', '0']}, - {'期別': '112000183', '開獎日期': '112/8/2', '獎號': ['4', '0', '4']}, - {'期別': '112000182', '開獎日期': '112/8/1', '獎號': ['9', '0', '1']} + {'期別': 112000208, '開獎日期': '2023-08-31T00:00:00', '獎號': [7, 2, 7]}, + {'期別': 112000207, '開獎日期': '2023-08-30T00:00:00', '獎號': [9, 0, 1]}, + {'期別': 112000206, '開獎日期': '2023-08-29T00:00:00', '獎號': [1, 5, 9]}, + {'期別': 112000205, '開獎日期': '2023-08-28T00:00:00', '獎號': [5, 6, 6]}, + {'期別': 112000204, '開獎日期': '2023-08-26T00:00:00', '獎號': [5, 8, 0]}, + {'期別': 112000203, '開獎日期': '2023-08-25T00:00:00', '獎號': [9, 7, 1]}, + {'期別': 112000202, '開獎日期': '2023-08-24T00:00:00', '獎號': [7, 0, 4]}, + {'期別': 112000201, '開獎日期': '2023-08-23T00:00:00', '獎號': [6, 3, 2]}, + {'期別': 112000200, '開獎日期': '2023-08-22T00:00:00', '獎號': [1, 5, 2]}, + {'期別': 112000199, '開獎日期': '2023-08-21T00:00:00', '獎號': [0, 9, 7]}, + {'期別': 112000198, '開獎日期': '2023-08-19T00:00:00', '獎號': [7, 4, 3]}, + {'期別': 112000197, '開獎日期': '2023-08-18T00:00:00', '獎號': [9, 8, 6]}, + {'期別': 112000196, '開獎日期': '2023-08-17T00:00:00', '獎號': [2, 7, 7]}, + {'期別': 112000195, '開獎日期': '2023-08-16T00:00:00', '獎號': [3, 1, 6]}, + {'期別': 112000194, '開獎日期': '2023-08-15T00:00:00', '獎號': [6, 4, 8]}, + {'期別': 112000193, '開獎日期': '2023-08-14T00:00:00', '獎號': [8, 9, 5]}, + {'期別': 112000192, '開獎日期': '2023-08-12T00:00:00', '獎號': [2, 1, 5]}, + {'期別': 112000191, '開獎日期': '2023-08-11T00:00:00', '獎號': [6, 1, 7]}, + {'期別': 112000190, '開獎日期': '2023-08-10T00:00:00', '獎號': [2, 7, 2]}, + {'期別': 112000189, '開獎日期': '2023-08-09T00:00:00', '獎號': [6, 8, 6]}, + {'期別': 112000188, '開獎日期': '2023-08-08T00:00:00', '獎號': [8, 0, 5]}, + {'期別': 112000187, '開獎日期': '2023-08-07T00:00:00', '獎號': [1, 2, 7]}, + {'期別': 112000186, '開獎日期': '2023-08-05T00:00:00', '獎號': [4, 7, 2]}, + {'期別': 112000185, '開獎日期': '2023-08-04T00:00:00', '獎號': [5, 0, 4]}, + {'期別': 112000184, '開獎日期': '2023-08-03T00:00:00', '獎號': [7, 4, 0]}, + {'期別': 112000183, '開獎日期': '2023-08-02T00:00:00', '獎號': [4, 0, 4]}, + {'期別': 112000182, '開獎日期': '2023-08-01T00:00:00', '獎號': [9, 0, 1]} ] @@ -163,36 +165,38 @@ def test_lotto4d(): lottery = TaiwanLotteryCrawler() # When user get the 4星彩 2023-08 result without print and output to json - lotto4d_result = lottery.lotto4d([112, 8]) + lotto4d_result = lottery.lotto4d(['2023', '08']) + + print(lotto4d_result) assert lotto4d_result == [ - {'期別': '112000208', '開獎日期': '112/8/31', '獎號': ['1', '1', '6', '1']}, - {'期別': '112000207', '開獎日期': '112/8/30', '獎號': ['1', '4', '3', '6']}, - {'期別': '112000206', '開獎日期': '112/8/29', '獎號': ['0', '1', '4', '9']}, - {'期別': '112000205', '開獎日期': '112/8/28', '獎號': ['3', '6', '2', '5']}, - {'期別': '112000204', '開獎日期': '112/8/26', '獎號': ['6', '1', '3', '8']}, - {'期別': '112000203', '開獎日期': '112/8/25', '獎號': ['2', '5', '8', '0']}, - {'期別': '112000202', '開獎日期': '112/8/24', '獎號': ['1', '8', '5', '1']}, - {'期別': '112000201', '開獎日期': '112/8/23', '獎號': ['5', '2', '8', '6']}, - {'期別': '112000200', '開獎日期': '112/8/22', '獎號': ['5', '4', '4', '9']}, - {'期別': '112000199', '開獎日期': '112/8/21', '獎號': ['7', '1', '5', '2']}, - {'期別': '112000198', '開獎日期': '112/8/19', '獎號': ['3', '4', '7', '6']}, - {'期別': '112000197', '開獎日期': '112/8/18', '獎號': ['6', '7', '8', '7']}, - {'期別': '112000196', '開獎日期': '112/8/17', '獎號': ['0', '3', '2', '6']}, - {'期別': '112000195', '開獎日期': '112/8/16', '獎號': ['4', '1', '3', '0']}, - {'期別': '112000194', '開獎日期': '112/8/15', '獎號': ['0', '9', '1', '1']}, - {'期別': '112000193', '開獎日期': '112/8/14', '獎號': ['3', '2', '5', '8']}, - {'期別': '112000192', '開獎日期': '112/8/12', '獎號': ['8', '4', '0', '9']}, - {'期別': '112000191', '開獎日期': '112/8/11', '獎號': ['4', '0', '6', '3']}, - {'期別': '112000190', '開獎日期': '112/8/10', '獎號': ['7', '1', '5', '5']}, - {'期別': '112000189', '開獎日期': '112/8/9', '獎號': ['9', '7', '8', '0']}, - {'期別': '112000188', '開獎日期': '112/8/8', '獎號': ['2', '7', '7', '0']}, - {'期別': '112000187', '開獎日期': '112/8/7', '獎號': ['7', '7', '2', '4']}, - {'期別': '112000186', '開獎日期': '112/8/5', '獎號': ['8', '2', '5', '4']}, - {'期別': '112000185', '開獎日期': '112/8/4', '獎號': ['6', '3', '0', '3']}, - {'期別': '112000184', '開獎日期': '112/8/3', '獎號': ['5', '1', '3', '9']}, - {'期別': '112000183', '開獎日期': '112/8/2', '獎號': ['5', '5', '5', '1']}, - {'期別': '112000182', '開獎日期': '112/8/1', '獎號': ['5', '0', '9', '3']}, + {'期別': 112000208, '開獎日期': '2023-08-31T00:00:00', '獎號': [1, 1, 6, 1]}, + {'期別': 112000207, '開獎日期': '2023-08-30T00:00:00', '獎號': [1, 4, 3, 6]}, + {'期別': 112000206, '開獎日期': '2023-08-29T00:00:00', '獎號': [0, 1, 4, 9]}, + {'期別': 112000205, '開獎日期': '2023-08-28T00:00:00', '獎號': [3, 6, 2, 5]}, + {'期別': 112000204, '開獎日期': '2023-08-26T00:00:00', '獎號': [6, 1, 3, 8]}, + {'期別': 112000203, '開獎日期': '2023-08-25T00:00:00', '獎號': [2, 5, 8, 0]}, + {'期別': 112000202, '開獎日期': '2023-08-24T00:00:00', '獎號': [1, 8, 5, 1]}, + {'期別': 112000201, '開獎日期': '2023-08-23T00:00:00', '獎號': [5, 2, 8, 6]}, + {'期別': 112000200, '開獎日期': '2023-08-22T00:00:00', '獎號': [5, 4, 4, 9]}, + {'期別': 112000199, '開獎日期': '2023-08-21T00:00:00', '獎號': [7, 1, 5, 2]}, + {'期別': 112000198, '開獎日期': '2023-08-19T00:00:00', '獎號': [3, 4, 7, 6]}, + {'期別': 112000197, '開獎日期': '2023-08-18T00:00:00', '獎號': [6, 7, 8, 7]}, + {'期別': 112000196, '開獎日期': '2023-08-17T00:00:00', '獎號': [0, 3, 2, 6]}, + {'期別': 112000195, '開獎日期': '2023-08-16T00:00:00', '獎號': [4, 1, 3, 0]}, + {'期別': 112000194, '開獎日期': '2023-08-15T00:00:00', '獎號': [0, 9, 1, 1]}, + {'期別': 112000193, '開獎日期': '2023-08-14T00:00:00', '獎號': [3, 2, 5, 8]}, + {'期別': 112000192, '開獎日期': '2023-08-12T00:00:00', '獎號': [8, 4, 0, 9]}, + {'期別': 112000191, '開獎日期': '2023-08-11T00:00:00', '獎號': [4, 0, 6, 3]}, + {'期別': 112000190, '開獎日期': '2023-08-10T00:00:00', '獎號': [7, 1, 5, 5]}, + {'期別': 112000189, '開獎日期': '2023-08-09T00:00:00', '獎號': [9, 7, 8, 0]}, + {'期別': 112000188, '開獎日期': '2023-08-08T00:00:00', '獎號': [2, 7, 7, 0]}, + {'期別': 112000187, '開獎日期': '2023-08-07T00:00:00', '獎號': [7, 7, 2, 4]}, + {'期別': 112000186, '開獎日期': '2023-08-05T00:00:00', '獎號': [8, 2, 5, 4]}, + {'期別': 112000185, '開獎日期': '2023-08-04T00:00:00', '獎號': [6, 3, 0, 3]}, + {'期別': 112000184, '開獎日期': '2023-08-03T00:00:00', '獎號': [5, 1, 3, 9]}, + {'期別': 112000183, '開獎日期': '2023-08-02T00:00:00', '獎號': [5, 5, 5, 1]}, + {'期別': 112000182, '開獎日期': '2023-08-01T00:00:00', '獎號': [5, 0, 9, 3]} ] @@ -201,18 +205,20 @@ def test_lotto38m6(): lottery = TaiwanLotteryCrawler() # When user get the 38樂合彩 2023-08 result without print and output to json - lotto38m6_result = lottery.lotto38m6([112, 8]) + lotto38m6_result = lottery.lotto38m6(['2023', '08']) + + print(lotto38m6_result) assert lotto38m6_result == [ - {'期別': '112000070', '開獎日期': '112/08/31', '獎號': ['30', '34', '27', '23', '04', '22']}, - {'期別': '112000069', '開獎日期': '112/08/28', '獎號': ['03', '08', '06', '15', '38', '24']}, - {'期別': '112000068', '開獎日期': '112/08/24', '獎號': ['21', '03', '23', '17', '38', '10']}, - {'期別': '112000067', '開獎日期': '112/08/21', '獎號': ['33', '19', '01', '12', '34', '14']}, - {'期別': '112000066', '開獎日期': '112/08/17', '獎號': ['04', '37', '18', '28', '23', '21']}, - {'期別': '112000065', '開獎日期': '112/08/14', '獎號': ['17', '04', '03', '26', '02', '10']}, - {'期別': '112000064', '開獎日期': '112/08/10', '獎號': ['03', '29', '21', '30', '38', '11']}, - {'期別': '112000063', '開獎日期': '112/08/07', '獎號': ['33', '29', '37', '03', '27', '31']}, - {'期別': '112000062', '開獎日期': '112/08/03', '獎號': ['25', '17', '33', '18', '27', '21']} + {'期別': 112000070, '開獎日期': '2023-08-31T00:00:00', '獎號': [4, 22, 23, 27, 30, 34]}, + {'期別': 112000069, '開獎日期': '2023-08-28T00:00:00', '獎號': [3, 6, 8, 15, 24, 38]}, + {'期別': 112000068, '開獎日期': '2023-08-24T00:00:00', '獎號': [3, 10, 17, 21, 23, 38]}, + {'期別': 112000067, '開獎日期': '2023-08-21T00:00:00', '獎號': [1, 12, 14, 19, 33, 34]}, + {'期別': 112000066, '開獎日期': '2023-08-17T00:00:00', '獎號': [4, 18, 21, 23, 28, 37]}, + {'期別': 112000065, '開獎日期': '2023-08-14T00:00:00', '獎號': [2, 3, 4, 10, 17, 26]}, + {'期別': 112000064, '開獎日期': '2023-08-10T00:00:00', '獎號': [3, 11, 21, 29, 30, 38]}, + {'期別': 112000063, '開獎日期': '2023-08-07T00:00:00', '獎號': [3, 27, 29, 31, 33, 37]}, + {'期別': 112000062, '開獎日期': '2023-08-03T00:00:00', '獎號': [17, 18, 21, 25, 27, 33]} ] @@ -221,17 +227,19 @@ def test_lotto49m6(): lottery = TaiwanLotteryCrawler() # When user get the 49樂合彩 2023-07 result without print and output to json - lotto49m6_result = lottery.lotto49m6([112, 7]) + lotto49m6_result = lottery.lotto49m6(['2023', '07']) + + print(lotto49m6_result) assert lotto49m6_result == [ - {'期別': '112000072', '開獎日期': '112/07/28', '獎號': ['03', '22', '25', '34', '44', '01']}, - {'期別': '112000071', '開獎日期': '112/07/25', '獎號': ['17', '33', '40', '12', '28', '45']}, - {'期別': '112000070', '開獎日期': '112/07/21', '獎號': ['03', '15', '35', '41', '49', '39']}, - {'期別': '112000069', '開獎日期': '112/07/18', '獎號': ['34', '19', '04', '40', '05', '16']}, - {'期別': '112000068', '開獎日期': '112/07/14', '獎號': ['17', '15', '10', '33', '34', '45']}, - {'期別': '112000067', '開獎日期': '112/07/11', '獎號': ['48', '26', '49', '21', '10', '34']}, - {'期別': '112000066', '開獎日期': '112/07/07', '獎號': ['24', '21', '03', '33', '15', '06']}, - {'期別': '112000065', '開獎日期': '112/07/04', '獎號': ['41', '06', '15', '24', '12', '16']}, + {'期別': 112000072, '開獎日期': '2023-07-28T00:00:00', '獎號': [1, 3, 22, 25, 34, 44]}, + {'期別': 112000071, '開獎日期': '2023-07-25T00:00:00', '獎號': [12, 17, 28, 33, 40, 45]}, + {'期別': 112000070, '開獎日期': '2023-07-21T00:00:00', '獎號': [3, 15, 35, 39, 41, 49]}, + {'期別': 112000069, '開獎日期': '2023-07-18T00:00:00', '獎號': [4, 5, 16, 19, 34, 40]}, + {'期別': 112000068, '開獎日期': '2023-07-14T00:00:00', '獎號': [10, 15, 17, 33, 34, 45]}, + {'期別': 112000067, '開獎日期': '2023-07-11T00:00:00', '獎號': [10, 21, 26, 34, 48, 49]}, + {'期別': 112000066, '開獎日期': '2023-07-07T00:00:00', '獎號': [3, 6, 15, 21, 24, 33]}, + {'期別': 112000065, '開獎日期': '2023-07-04T00:00:00', '獎號': [6, 12, 15, 16, 24, 41]} ] @@ -240,33 +248,33 @@ def test_lotto39m5(): lottery = TaiwanLotteryCrawler() # When user get the 39樂合彩 2023-07 result without print and output to json - lotto39m5_result = lottery.lotto39m5([112, 7]) + lotto39m5_result = lottery.lotto39m5(['2023', '07']) assert lotto39m5_result == [ - {'期別': '112000181', '開獎日期': '112/07/31', '獎號': ['13', '21', '03', '19', '35']}, - {'期別': '112000180', '開獎日期': '112/07/29', '獎號': ['37', '30', '18', '15', '20']}, - {'期別': '112000179', '開獎日期': '112/07/28', '獎號': ['20', '26', '07', '01', '13']}, - {'期別': '112000178', '開獎日期': '112/07/27', '獎號': ['13', '39', '10', '18', '37']}, - {'期別': '112000177', '開獎日期': '112/07/26', '獎號': ['37', '13', '06', '33', '38']}, - {'期別': '112000176', '開獎日期': '112/07/25', '獎號': ['15', '32', '18', '26', '19']}, - {'期別': '112000175', '開獎日期': '112/07/24', '獎號': ['31', '34', '02', '37', '13']}, - {'期別': '112000174', '開獎日期': '112/07/22', '獎號': ['15', '32', '04', '09', '24']}, - {'期別': '112000173', '開獎日期': '112/07/21', '獎號': ['27', '26', '31', '39', '09']}, - {'期別': '112000172', '開獎日期': '112/07/20', '獎號': ['23', '13', '20', '18', '31']}, - {'期別': '112000171', '開獎日期': '112/07/19', '獎號': ['02', '35', '22', '12', '20']}, - {'期別': '112000170', '開獎日期': '112/07/18', '獎號': ['23', '29', '38', '15', '12']}, - {'期別': '112000169', '開獎日期': '112/07/17', '獎號': ['29', '01', '22', '18', '30']}, - {'期別': '112000168', '開獎日期': '112/07/15', '獎號': ['08', '22', '19', '21', '16']}, - {'期別': '112000167', '開獎日期': '112/07/14', '獎號': ['14', '25', '37', '12', '20']}, - {'期別': '112000166', '開獎日期': '112/07/13', '獎號': ['19', '06', '10', '32', '04']}, - {'期別': '112000165', '開獎日期': '112/07/12', '獎號': ['09', '01', '32', '02', '10']}, - {'期別': '112000164', '開獎日期': '112/07/11', '獎號': ['35', '38', '25', '24', '36']}, - {'期別': '112000163', '開獎日期': '112/07/10', '獎號': ['15', '04', '19', '37', '01']}, - {'期別': '112000162', '開獎日期': '112/07/08', '獎號': ['33', '24', '01', '18', '04']}, - {'期別': '112000161', '開獎日期': '112/07/07', '獎號': ['30', '16', '12', '25', '28']}, - {'期別': '112000160', '開獎日期': '112/07/06', '獎號': ['21', '17', '02', '33', '14']}, - {'期別': '112000159', '開獎日期': '112/07/05', '獎號': ['05', '08', '07', '25', '30']}, - {'期別': '112000158', '開獎日期': '112/07/04', '獎號': ['14', '27', '29', '26', '35']}, - {'期別': '112000157', '開獎日期': '112/07/03', '獎號': ['28', '34', '33', '39', '13']}, - {'期別': '112000156', '開獎日期': '112/07/01', '獎號': ['12', '22', '08', '39', '07']}, + {'期別': 112000181, '開獎日期': '2023-07-31T00:00:00', '獎號': [3, 13, 19, 21, 35]}, + {'期別': 112000180, '開獎日期': '2023-07-29T00:00:00', '獎號': [15, 18, 20, 30, 37]}, + {'期別': 112000179, '開獎日期': '2023-07-28T00:00:00', '獎號': [1, 7, 13, 20, 26]}, + {'期別': 112000178, '開獎日期': '2023-07-27T00:00:00', '獎號': [10, 13, 18, 37, 39]}, + {'期別': 112000177, '開獎日期': '2023-07-26T00:00:00', '獎號': [6, 13, 33, 37, 38]}, + {'期別': 112000176, '開獎日期': '2023-07-25T00:00:00', '獎號': [15, 18, 19, 26, 32]}, + {'期別': 112000175, '開獎日期': '2023-07-24T00:00:00', '獎號': [2, 13, 31, 34, 37]}, + {'期別': 112000174, '開獎日期': '2023-07-22T00:00:00', '獎號': [4, 9, 15, 24, 32]}, + {'期別': 112000173, '開獎日期': '2023-07-21T00:00:00', '獎號': [9, 26, 27, 31, 39]}, + {'期別': 112000172, '開獎日期': '2023-07-20T00:00:00', '獎號': [13, 18, 20, 23, 31]}, + {'期別': 112000171, '開獎日期': '2023-07-19T00:00:00', '獎號': [2, 12, 20, 22, 35]}, + {'期別': 112000170, '開獎日期': '2023-07-18T00:00:00', '獎號': [12, 15, 23, 29, 38]}, + {'期別': 112000169, '開獎日期': '2023-07-17T00:00:00', '獎號': [1, 18, 22, 29, 30]}, + {'期別': 112000168, '開獎日期': '2023-07-15T00:00:00', '獎號': [8, 16, 19, 21, 22]}, + {'期別': 112000167, '開獎日期': '2023-07-14T00:00:00', '獎號': [12, 14, 20, 25, 37]}, + {'期別': 112000166, '開獎日期': '2023-07-13T00:00:00', '獎號': [4, 6, 10, 19, 32]}, + {'期別': 112000165, '開獎日期': '2023-07-12T00:00:00', '獎號': [1, 2, 9, 10, 32]}, + {'期別': 112000164, '開獎日期': '2023-07-11T00:00:00', '獎號': [24, 25, 35, 36, 38]}, + {'期別': 112000163, '開獎日期': '2023-07-10T00:00:00', '獎號': [1, 4, 15, 19, 37]}, + {'期別': 112000162, '開獎日期': '2023-07-08T00:00:00', '獎號': [1, 4, 18, 24, 33]}, + {'期別': 112000161, '開獎日期': '2023-07-07T00:00:00', '獎號': [12, 16, 25, 28, 30]}, + {'期別': 112000160, '開獎日期': '2023-07-06T00:00:00', '獎號': [2, 14, 17, 21, 33]}, + {'期別': 112000159, '開獎日期': '2023-07-05T00:00:00', '獎號': [5, 7, 8, 25, 30]}, + {'期別': 112000158, '開獎日期': '2023-07-04T00:00:00', '獎號': [14, 26, 27, 29, 35]}, + {'期別': 112000157, '開獎日期': '2023-07-03T00:00:00', '獎號': [13, 28, 33, 34, 39]}, + {'期別': 112000156, '開獎日期': '2023-07-01T00:00:00', '獎號': [7, 8, 12, 22, 39]} ]