From d6b1ad1cac8f8dbdd90ea1f072912c3097d87957 Mon Sep 17 00:00:00 2001 From: Cinabre Date: Wed, 16 Dec 2020 17:08:10 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20l'image=20dans=20la=20base=20de=20?= =?UTF-8?q?donn=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- create_manga.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/create_manga.py b/create_manga.py index 349e9d1..f8dedbf 100644 --- a/create_manga.py +++ b/create_manga.py @@ -16,21 +16,23 @@ def create_manga(url): "title" : get_title(url), "author" : get_author(url), "url" : url, - "chap" : get_last_chap(url)} + "chap" : get_last_chap(url), + "img" : get_img(url)} - print("Id : " + str(data["id"])) - print("Title : " + str(data["title"])) - print("Author : " + str(data["author"])) - print("Link : " + url) + print("Id : " + str(data["id"])) + print("Title : " + str(data["title"])) + print("Author : " + str(data["author"])) + print("Link : " + url) print("Last chap : " + str(data["chap"])) - cursor.execute(""" INSERT INTO manga(id, title, author, url, chap) VALUES(:id, :title, :author, :url, :chap)""", data) + print("Image : " + str(get_img(url))) + + cursor.execute(""" INSERT INTO manga(id, title, author, url, chap, img) VALUES(:id, :title, :author, :url, :chap, :img)""", data) conn.commit() def main(): if len(sys.argv) == 2 : print("Mode Script") url = sys.argv[1] - print("URL : %s" % url) try : create_manga(url) except sqlite3.IntegrityError :