Rename import bot -> youtube_credentials.

In the days of making reddit bots I always put creds into bot.py.
But for this project it wouldn't make any sense to newcomers.
This commit is contained in:
voussoir 2021-04-25 18:02:26 -07:00
parent 8a6f33851e
commit 74d4a55d32
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
6 changed files with 14 additions and 12 deletions

View file

@ -37,7 +37,7 @@ The reason for this is that youtube-dl is extremely configurable. Every user mig
## Your API key
You are responsible for your own `bot.py` file, with a function `get_youtube_key`. YCDL will `import bot` and call `bot.get_youtube_key()` with no arguments. It should return a Youtube API key. Here is how to get one:
You are responsible for your own `youtube_credentials.py` file on your PYTHONPATH, with a function `get_youtube_key`. YCDL will `import youtube_credentials` and call `youtube_credentials.get_youtube_key()` with no arguments. It should return a Youtube API key. Here is how to get one:
1. Go to https://console.developers.google.com/.
2. Create a project using the menu in the upper left.

View file

@ -20,8 +20,8 @@ import sys
from voussoirkit import pathclass
from voussoirkit import vlogging
import bot
import ycdl
import youtube_credentials
import backend
site = backend.site
@ -61,7 +61,7 @@ def ycdl_flask_launch(
if localhost_only:
site.localhost_only = True
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
youtube_core = ycdl.ytapi.Youtube(youtube_credentials.get_youtube_key())
backend.common.init_ycdldb(youtube_core, create=create, log_level=LOG_LEVEL)
ycdl.ytrss.log.setLevel(LOG_LEVEL)

View file

@ -8,8 +8,8 @@ gunicorn ycdl_flask_prod:site --bind "0.0.0.0:PORT" --access-logfile "-"
'''
import werkzeug.middleware.proxy_fix
import bot
import ycdl
import youtube_credentials
import backend
@ -19,6 +19,6 @@ site = backend.site
site.debug = False
# NOTE: Consider adding a local .json config file.
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
youtube_core = ycdl.ytapi.Youtube(youtube_credentials.get_youtube_key())
backend.common.init_ycdldb(youtube_core, create=False)
backend.common.start_refresher_thread(86400)

View file

@ -6,8 +6,8 @@ import logging
logging.basicConfig()
logging.getLogger('ycdl').setLevel(logging.DEBUG)
import bot
import ycdl
import youtube_credentials
youtube = ycdl.ytapi.Youtube(bot.get_youtube_key())
youtube = ycdl.ytapi.Youtube(youtube_credentials.get_youtube_key())
Y = ycdl.ycdldb.YCDLDB(youtube)

View file

@ -3,8 +3,8 @@ import os
import sqlite3
import sys
import bot
import ycdl
import youtube_credentials
class Migrator:
'''
@ -291,7 +291,7 @@ def upgrade_all(data_directory):
Given the directory containing a ycdl database, apply all of the
needed upgrade_x_to_y functions in order.
'''
youtube = ycdl.ytapi.Youtube(bot.get_youtube_key())
youtube = ycdl.ytapi.Youtube(youtube_credentials.get_youtube_key())
ycdldb = ycdl.ycdldb.YCDLDB(youtube, data_directory, skip_version_check=True)
cur = ycdldb.sql.cursor()

View file

@ -1,10 +1,12 @@
import bot3 as bot
import os
import traceback
import ycdl
from voussoirkit import downloady
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
import ycdl
import youtube_credentials
youtube_core = ycdl.ytapi.Youtube(youtube_credentials.get_youtube_key())
ycdldb = ycdl.ycdldb.YCDLDB(youtube_core)
DIRECTORY = '.\\youtube thumbnails'