webscraper/app/main.py
paprykdev f65292d891
Some checks are pending
Docker Image CI / build (push) Waiting to run
feat: seperate all logic into small methods
2024-11-13 23:56:43 +01:00

28 lines
493 B
Python

from scraper import scrap
import os
import json
import time
urls = ["https://digitalprojects.wpi.art/monet/artworks"]
hrefs = []
def main():
directory = "dist"
file_path = os.path.join(directory, "data.json")
scrap(urls[0])
data = []
try:
os.mkdir("dist")
except FileExistsError:
pass
with open(file_path, "w", encoding="utf-8") as file:
json.dump(data, file)
print("Data has been scraped!")
if __name__ == "__main__":
main()