def build_yt_api():
"""Build the YouTube API for future use"""
data = datatools.get_data()
if "google_api_key" not in data["discord"]["keys"]:
logger.warning("No API key found with name 'google_api_key'")
logger.info("Please add your Google API key with name 'google_api_key' "
"in data.json to use YouTube features of the music module")
return False
logger.debug("Building YouTube discovery API")
ytdevkey = data["discord"]["keys"]["google_api_key"]
try:
global ytdiscoveryapi
ytdiscoveryapi = googleapiclient.discovery.build("youtube", "v3", developerKey=ytdevkey)
logger.debug("YouTube API build successful")
return True
except Exception as e:
logger.exception(e)
logger.warning("HTTP error connecting to YouTube API, YouTube won't be available")
return False
评论列表
文章目录