|
6 | 6 | import os |
7 | 7 | from dotenv import load_dotenv |
8 | 8 |
|
9 | | -# Cargar las variables de entorno desde .env |
| 9 | +# Cargar las variables de entorno desde .env para obtener CLIENT_ID y CLIENT_SECRET |
10 | 10 | load_dotenv() |
11 | 11 |
|
12 | | -# Obtener CLIENT_ID y CLIENT_SECRET desde las variables de entorno |
13 | 12 | CLIENT_ID = os.getenv("CLIENT_ID") |
14 | 13 | CLIENT_SECRET = os.getenv("CLIENT_SECRET") |
15 | 14 |
|
| 15 | +# Funciones |
| 16 | + |
16 | 17 |
|
17 | 18 | def obtener_token() -> str: |
18 | 19 | url = "https://id.twitch.tv/oauth2/token" |
@@ -116,6 +117,8 @@ def buscar_info_canal(token: str, broadcaster_id: str): |
116 | 117 | "tópicos del canal": "sin información", |
117 | 118 | } |
118 | 119 |
|
| 120 | +# Uso de codigo |
| 121 | + |
119 | 122 |
|
120 | 123 | token = obtener_token() |
121 | 124 |
|
@@ -221,18 +224,18 @@ def buscar_info_canal(token: str, broadcaster_id: str): |
221 | 224 | print(f"Participante: {participante_evento_fortnite['usuario twitch']}, Estado: { |
222 | 225 | participante_evento_fortnite['estado del usuario de twitch']}, Seguidores: {participante_evento_fortnite['total seguidores']}") |
223 | 226 |
|
224 | | -print("\nLista de antigueddad de las cuentas de los participantes del evento Rubius Cup en Twitch\n") |
| 227 | +print("\nLista de antiguedad de las cuentas de los participantes del evento Rubius Cup en Twitch\n") |
225 | 228 |
|
226 | 229 | # Participantes del evento Rubius Cup |
227 | 230 | for participante_evento_fortnite in informacion_participantes_antiguedad: |
228 | 231 | fecha_creacion = participante_evento_fortnite.get("creación de cuenta") |
229 | 232 |
|
230 | 233 | if isinstance(fecha_creacion, datetime): |
231 | | - fecha_visual = fecha_creacion.strftime("%d-%m-%Y %H:%M:%S") |
| 234 | + fecha = fecha_creacion.strftime("%d-%m-%Y %H:%M:%S") |
232 | 235 | elif isinstance(fecha_creacion, str): |
233 | | - fecha_visual = fecha_creacion |
| 236 | + fecha = fecha_creacion |
234 | 237 | else: |
235 | | - fecha_visual = "Información no disponible" |
| 238 | + fecha = "Información no disponible" |
236 | 239 |
|
237 | 240 | print(f"Participante: {participante_evento_fortnite['usuario twitch']}, Estado: { |
238 | | - participante_evento_fortnite['estado del usuario de twitch']}, Creación de cuenta: {fecha_visual}") |
| 241 | + participante_evento_fortnite['estado del usuario de twitch']}, Creación de cuenta: {fecha}") |
0 commit comments