/TaiwanLotteryCrawler

Taiwan Lottery Crawler 台灣 樂透 彩券 爬蟲

Primary LanguagePythonMIT LicenseMIT

Taiwan Lottery Crawler

這個專案是用來爬取 台灣彩券 官網上歷史的開獎紀錄,目前支援威力彩大樂透今彩539雙贏彩 4 種彩券遊戲。

Features

  • 爬取 威力彩、大樂透、今彩539、雙贏彩 4 種彩券遊戲的開獎紀錄。
  • 爬取結果可直接輸出產生成 json 格式檔案進行後續使用。
  • 針對單一的彩券遊戲可以爬取幾個月前的開獎紀錄。

Requirements

Install

$ git clone https://github.com/stu01509/TaiwanLotteryCrawler.git
$ cd TaiwanLotteryCrawler
$ pip install -r requirements.txt

Command

爬取當月份的開獎紀錄

$ python crawl.py

爬取當月份的開獎紀錄並輸出 JSON

$ python crawl.py -o

往回爬取指定彩券的幾個月前的開獎紀錄

爬取 5 個月前的開獎資料

$ python crawl.py 威力彩 -b 5
$ python crawl.py 大樂透 -b 5
$ python crawl.py 今彩539 -b 5
$ python crawl.py 雙贏彩 -b 5

往回爬取指定彩券的幾個月前的開獎紀錄並輸出 JSON

爬取 5 個月前的開獎資料並輸出 JSON

$ python crawl.py 威力彩 -b 5 -o
$ python crawl.py 大樂透 -b 5 -o
$ python crawl.py 今彩539 -b 5 -o
$ python crawl.py 雙贏彩 -b 5 -o

爬取指定彩券的年月的開獎紀錄

爬取 2020 年 4 月份的開獎紀錄

$ python crawl.py 威力彩 -t 2020-04
$ python crawl.py 大樂透 -t 2020-04
$ python crawl.py 今彩539 -t 2020-04
$ python crawl.py 雙贏彩 -t 2020-04

爬取指定彩券的年月的開獎紀錄並輸出 JSON

爬取 2020 年 4 月份的開獎紀錄並輸出 JSON

$ python crawl.py 威力彩 -t 2020-04 -o
$ python crawl.py 大樂透 -t 2020-04 -o
$ python crawl.py 今彩539 -t 2020-04 -o
$ python crawl.py 雙贏彩 -t 2020-04 -o

指令說明

$ python crawl.py -h

Data Source

License

MIT License