Skip to content

Commit

Permalink
Sat, Aug 3, 2024, 2:21 PM +03:00
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdoullahBougataya committed Aug 3, 2024
1 parent 4ab90be commit 05e5099
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Binary file added __pycache__/images_links.cpython-311.pyc
Binary file not shown.
7 changes: 3 additions & 4 deletions database_updater.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sqlite3
import scrapper
import images_scrapper
import images_links

con = sqlite3.connect('db\database.db')

Expand All @@ -12,7 +12,7 @@

titles, engines = scrapper()

images = images_scrapper()
images = images_links()

# Creating table
table = """ CREATE TABLE rocket_engines (Id INTEGER NOT NULL PRIMARY KEY, """
Expand All @@ -29,9 +29,8 @@
print("Table is Ready")
print("Filling the database...")
for i in range(len(engines)):
img = "http://localhost:8080" + images[i]
cur = con.cursor()
cur.execute(f"INSERT INTO rocket_engines VALUES {(i, ) + engines[i] + (img, )};".replace("''", "NULL"))
cur.execute(f"INSERT INTO rocket_engines VALUES {(i, ) + engines[i] + (images[i], )};".replace("''", "NULL"))
con.commit()
print(f"{int(100 * (i/len(engines)))}% done")
print(f'100% done')
Expand Down
Binary file modified db/database.db
Binary file not shown.
6 changes: 3 additions & 3 deletions images_scrapper.py → images_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import sys

# This function get the links of images of rocket engines
def images_scrapper():
def images_links():
engines = scrapper()[1]
print("Downloading images...")
print("Getting images links...")
paths = ()
c = 0
for engine in engines:
Expand Down Expand Up @@ -35,4 +35,4 @@ def images_scrapper():
print(f"100% done")
return paths

sys.modules[__name__] = images_scrapper
sys.modules[__name__] = images_links

0 comments on commit 05e5099

Please sign in to comment.