moved youtube scirpts into there own folder
This commit is contained in:
1 parent
8bf85fea2e
commit
afe6490d20
15 files changed
+127
-102
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
|
||||
from google.oauth2.credentials import Credentials
|
||||
from google.auth.transport.requests import Request
|
||||
|
||||
CREDENTIALS = None
|
||||
|
||||
def load_credentials() -> Credentials:
|
||||
"""Load credentials from secrets.json"""
|
||||
try:
|
||||
with open('secrets.json', 'r') as f:
|
||||
creds_data = json.load(f)
|
||||
|
||||
credentials = Credentials(
|
||||
token=creds_data['token'],
|
||||
refresh_token=creds_data['refresh_token'],
|
||||
token_uri=creds_data['token_uri'],
|
||||
client_id=creds_data['client_id'],
|
||||
client_secret=creds_data['client_secret'],
|
||||
scopes=creds_data['scopes']
|
||||
)
|
||||
|
||||
# Refresh token if expired
|
||||
if credentials.expired:
|
||||
credentials.refresh(Request())
|
||||
|
||||
return credentials
|
||||
except FileNotFoundError:
|
||||
print("Error: secrets.json not found! Please run setup.py first.")
|
||||
return None
|
||||
except Exception as e:
|
||||
print(f"Error loading credentials: {str(e)}")
|
||||
return None
|
||||
|
||||
CREDENTIALS = load_credentials()
|
||||
Reference in new issue
Block a user