|
|
|
@@ -5,18 +5,19 @@ |
|
|
|
import logging |
|
|
|
import requests |
|
|
|
import json |
|
|
|
from bot import login_beta, user_id, token_bot, client_id |
|
|
|
from bot import user_id, token_bot, client_id |
|
|
|
from betaseries import login_beta, create_api |
|
|
|
from telegram.ext import Updater, CommandHandler |
|
|
|
|
|
|
|
#Love Is War / Une serie pour tester le programme. |
|
|
|
thetvdb_id= '354198' |
|
|
|
|
|
|
|
|
|
|
|
def create_api(choice): |
|
|
|
if choice == 'latest' : |
|
|
|
base_url = 'https://api.betaseries.com/episodes/latest?' |
|
|
|
API = base_url + 'token=' + token + '&client_id=' + client_id + '&thetvdb_id=' + thetvdb_id |
|
|
|
return API |
|
|
|
# def create_api(choice): |
|
|
|
# if choice == 'latest' : |
|
|
|
# base_url = 'https://api.betaseries.com/episodes/latest?' |
|
|
|
# API = base_url + 'token=' + token + '&client_id=' + client_id + '&thetvdb_id=' + thetvdb_id |
|
|
|
# return API |
|
|
|
|
|
|
|
def check_latest(): |
|
|
|
API = create_api('latest') |
|
|
|
@@ -26,10 +27,7 @@ def check_latest(): |
|
|
|
show = request.json() |
|
|
|
episode = show['episode'] |
|
|
|
|
|
|
|
###Recuperation du titre |
|
|
|
title = episode['show'] |
|
|
|
|
|
|
|
|
|
|
|
print("Titre de la serie : ", str(title['title'])) |
|
|
|
|
|
|
|
# print("Episode : ", data[episode], " Saison : ", data[season] ) |
|
|
|
@@ -50,9 +48,6 @@ def main(): |
|
|
|
print("Pour arreter le script : CTRL+Z") |
|
|
|
|
|
|
|
check_latest() |
|
|
|
# while 1 : |
|
|
|
# #print(démarrage boucle) |
|
|
|
# print("Boucle") |
|
|
|
|
|
|
|
|
|
|
|
print("Erreur ! Fin de la boucle") |
|
|
|
|