gingeleski / odds-portal-scraper

Sports odds and results scraping for Odds Portal (oddsportal.com).
The Unlicense
104 stars 53 forks source link

Enhancements to full_scraper allowing selection of seasons, sportsbooks, bet types, bet options #17

Open jemorriso opened 3 years ago

jemorriso commented 3 years ago

First of all thanks for creating this library! I was planning on creating a scraper to get WHL and OHL odds but luckily I found this which saved me a ton of time. I tried to leave as much of the code in an unchanged state, but inevitably I had to make some changes. This is a work in progress and some stuff is rough around the edges.

Might be best to run it with DEBUG set to true in both scraper and op so you can get a sense of what the code is doing.

I added a bunch of config files that I used for testing along with their output files as examples. These do not need to be included.

I've never made a pull request before so sorry if I didn't follow guidelines properly. Let me know what you think!

Proposed Changes

Adding a bunch of functionality to full_scraper. Most of the changes are in scraper.py. Depending on the configuration provided by the user (adding to previous config found in sports.json) the scraper will behave exactly how it did previously, or it will go to the game link and scrape odds for sportsbook / bet market / bet options.

This is a breaking change.

Description

Config JSON file

New config options (they are optional):

example URL: https://www.oddsportal.com/hockey/canada/ohl/flint-firebirds-windsor-spitfires-40a8ssXS/#home-away;1

op.py

New global variables:

Attributes added to working_seasons elements:

models.py

scraper.py

New global variables:

Functions:

To Do

Issues

obtim commented 3 years ago

Don't work on Windows 7, Python 3.8(x86) c:\Helper\full_scraper>python op.py Traceback (most recent call last): File "op.py", line 8, in from joblib import delayed File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib__init.py", line 119, in from .parallel import Parallel File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib\parallel.py", line 28, in from ._parallel_backends import (FallbackToBackend, MultiprocessingBackend, File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib_parallel_backends.py", line 22, in from .executor import get_memmapping_executor File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib\executor.py", line 14, in from .externals.loky.reusable_executor import get_reusable_executor File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib\externals\loky\init.py", line 12, in from .backend.reduction import set_loky_pickler File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib\externals\loky\backend\reduction.py", line 125, in from joblib.externals import cloudpickle # noqa: F401 File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib\externals\cloudpickle\init__.py", line 3, in from .cloudpickle import * File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib\externals\cloudpickle\cloudpickle.py", line 152, in _cell_set_template_code = _make_cell_set_template_code() File "C:\Users\obtim\AppData\Local\Programs\Python\Python38-32\lib\site-packag es\joblib\externals\cloudpickle\cloudpickle.py", line 133, in _make_cell_set_tem plate_code return types.CodeType( TypeError: an integer is required (got type bytes)

jemorriso commented 3 years ago

Huh. I can't explain that, but the changes in this pull request should not be what's causing that error. Have you tried running the unforked code?

obtim commented 3 years ago

Huh. I can't explain that, but the changes in this pull request should not be what's causing that error. Have you tried running the unforked code?

In my case, I had to manually update all packages to the latest: pip list -o