Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

64 řádky
1.6 KiB

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # This program is dedicated to the public domain under the CC0 license.
  4. # Telegram - Betaseries
  5. import logging
  6. import requests
  7. import json
  8. from bot import login_beta, user_id, token_bot, client_id
  9. from telegram.ext import Updater, CommandHandler
  10. #Love Is War / Une serie pour tester le programme.
  11. thetvdb_id= '354198'
  12. def create_api(choice):
  13. if choice == 'latest' :
  14. base_url = 'https://api.betaseries.com/episodes/latest?'
  15. API = base_url + 'token=' + token + '&client_id=' + client_id + '&thetvdb_id=' + thetvdb_id
  16. return API
  17. def check_latest():
  18. API = create_api('latest')
  19. request = requests.get(API)
  20. if str(request) != '<Response [200]>' :
  21. return False
  22. show = request.json()
  23. episode = show['episode']
  24. ###Recuperation du titre
  25. title = episode['show']
  26. print("Titre de la serie : ", str(title['title']))
  27. # print("Episode : ", data[episode], " Saison : ", data[season] )
  28. def main():
  29. global token
  30. token = login_beta()
  31. print("------------------------------")
  32. print("Votre ID Telegram : ", user_id)
  33. print("Token du bot Telegram : ", token_bot)
  34. print("Cle API de betaserie : ", client_id)
  35. print("Token betaseries : ", token)
  36. print("------------------------------")
  37. print("\n\t")
  38. print("Pour arreter le script : CTRL+Z")
  39. check_latest()
  40. # while 1 :
  41. # #print(démarrage boucle)
  42. # print("Boucle")
  43. print("Erreur ! Fin de la boucle")
  44. if __name__ == '__main__':
  45. main()