Un serveur permettant de récupérer à quelle manga on s'est arrêté d'une licence.
Un script se chargera de récupérer automatiquement les derniers mangas à jour à l'aide du site MangaDex
25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- # coding: utf-8
- from mangadex import *
- import sqlite3
-
- conn = sqlite3.connect('database.db')
- cursor = conn.cursor()
-
- def main():
- #print("Pas de fonction Main")
- fetch_all_id()
-
- def fetch_all_id():
- print("Recuperation des IDs")
- cursor.execute("SELECT id FROM manga;")
- rows = cursor.fetchall()
- print("----- MISE A JOUR DES CHAPITRES -----")
- for i in range(len(rows)):
- print(rows[i][0])
- update_manga(rows[i][0])
- print("----- FIN -----")
- def update_manga(id):
- url = get_url(id)
- # On récupère l'URL
-
- cursor.execute("SELECT chap FROM manga WHERE id = '%s'" % id)
-
- rows = cursor.fetchall()
- # Last_chapt est le dernier chapitre sauvegardé
- last_chapt = str(rows[0][0])
-
- new_chapt = get_last_chap(url)
- print("Mise a jour de %s" % get_title(url))
- print("Le dernier chapitre est %s" % last_chapt)
- print("Le dernier chapitre sur mangadex est %s" % new_chapt)
-
- if int(last_chapt) == int(new_chapt) :
- print("Nous sommes a jour")
- else :
- print("Pas a jour ! Le dernier chapitre est %s " % new_chapt)
- cursor.execute("UPDATE manga SET chap = '{}' WHERE id = '{}'".format(get_last_chap(url), get_id(url)))
- conn.commit()
-
- if __name__ == '__main__':
- main()
|