浏览代码

Mise à jour de 'notification.py'

master
TheBidouilleur 8 个月前
父节点
当前提交
3eb384695e
共有 1 个文件被更改,包括 16 次插入30 次删除
  1. +16
    -30
      notification.py

+ 16
- 30
notification.py 查看文件

@@ -2,41 +2,21 @@
# -*- coding: utf-8 -*-
# This program is dedicated to the public domain under the CC0 license.
# Telegram - Betaseries

import logging
import requests
import json
from bot import user_id, token_bot, client_id
from betaseries import login_beta, create_api
from betaseries import login_beta, create_api, check_latest
from telegram.ext import Updater, CommandHandler

#Love Is War / Une serie pour tester le programme.
thetvdb_id= '354198'
from config import series
import os.path
from os import path
import datetime


# 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')
request = requests.get(API)
if str(request) != '<Response [200]>' :
return False
show = request.json()
episode = show['episode']
title = episode['show']
print("Titre de la serie : ", str(title['title']))
# print("Episode : ", data[episode], " Saison : ", data[season] )

def main():
global token
token = login_beta()
print("------------------------------")
print("Votre ID Telegram : ", user_id)
@@ -47,12 +27,18 @@ def main():
print("\n\t")
print("Pour arreter le script : CTRL+Z")
check_latest()
now = datetime.datetime.now()
print (now.strftime("%Y-%m-%d %H:%M:%S"))
for i in range(len(series)):
thetvdb_id = series[i]
check_latest(thetvdb_id)
print("Erreur ! Fin de la boucle")


#print("Erreur ! Fin de la boucle")


if __name__ == '__main__':

正在加载...
取消
保存