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ů.

notification.py 1.5 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 user_id, token_bot, client_id
  9. from betaseries import login_beta, create_api
  10. from telegram.ext import Updater, CommandHandler
  11. #Love Is War / Une serie pour tester le programme.
  12. thetvdb_id= '354198'
  13. # def create_api(choice):
  14. # if choice == 'latest' :
  15. # base_url = 'https://api.betaseries.com/episodes/latest?'
  16. # API = base_url + 'token=' + token + '&client_id=' + client_id + '&thetvdb_id=' + thetvdb_id
  17. # return API
  18. def check_latest():
  19. API = create_api('latest')
  20. request = requests.get(API)
  21. if str(request) != '<Response [200]>' :
  22. return False
  23. show = request.json()
  24. episode = show['episode']
  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. print("Erreur ! Fin de la boucle")
  41. if __name__ == '__main__':
  42. main()