https://github.com/huyqle3/bballfast
2017 Example NBA basketball website using nba_py for people to learn how to use NBA Stats Python API.
https://github.com/huyqle3/bballfast
nba nba-api nba-statistics nba-stats nba-stats-api python
Last synced: 3 months ago
JSON representation
2017 Example NBA basketball website using nba_py for people to learn how to use NBA Stats Python API.
- Host: GitHub
- URL: https://github.com/huyqle3/bballfast
- Owner: huyqle3
- Created: 2017-03-30T03:11:19.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-02T23:36:01.000Z (about 8 years ago)
- Last Synced: 2024-04-15T00:03:24.186Z (about 2 years ago)
- Topics: nba, nba-api, nba-statistics, nba-stats, nba-stats-api, python
- Language: HTML
- Homepage:
- Size: 2.22 MB
- Stars: 25
- Watchers: 3
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bballfast
[YouTube Tutorial](https://www.youtube.com/watch?v=PLfkns6lZH8)

### Requirements
0. Have `pip` installed. `sudo apt-get install pip`
1. `pip install -r requirements.txt`
2. `OPTIONAL` You can also install the latest version of [nba_py](https://github.com/seemethere/nba_py)
### Create YouTube and Reddit API keys
Create YouTube Data v3 API Credentials Key at:
[https://console.developers.google.com/apis/dashboard](https://console.developers.google.com/apis/dashboard)
Create Reddit Client ID and Client Secret Key at:
[https://www.reddit.com/prefs/apps](https://www.reddit.com/prefs/apps)
Put the YouTube and Reddit API keys inside `__init__.py`.
```
# YouTube Developer Key
DEVELOPER_KEY = ""
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
# Example Reddit API Key
reddit = praw.Reddit(client_id="gjOCeed5Odsd3a",
client_secret="O0GP_rbfgRo_AxW1dyXCjteqGcd",
user_agent="bballfast by /u/microwavesam")
```
- If you don't want YouTube functionality, comment out the contents of the YouTube function.
```
def youtube_search(q, max_results=25, freedawkins=None):
"""Searches YouTube for q and returns YouTube link.
"""
"""
youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,
developerKey=DEVELOPER_KEY)
# Call the search.list method to retrieve results matching the specified
# query term.
if (freedawkins):
search_response = youtube.search().list(q=q,
part="id,snippet",
maxResults=max_results,
channelId="UCEjOSbbaOfgnfRODEEMYlCw").execute()
else:
search_response = youtube.search().list(q=q,
part="id,snippet",
maxResults=max_results,
type="video").execute()
# Add each result to the appropriate list, and then display the lists of
# matching videos, channels, and playlists.
for search_result in search_response.get("items", []):
if search_result["id"]["kind"] == "youtube#video":
return "//www.youtube.com/embed/" + search_result["id"]["videoId"]
"""
return False
```
### Run locally
To run the server locally at [http://127.0.0.1:8080](http://127.0.0.1:8080).
```
python __init__.py
```
