2024-11-13 23:56:43 +01:00
|
|
|
from scraper import scrap
|
|
|
|
import os
|
|
|
|
import json
|
2024-11-12 05:16:21 +01:00
|
|
|
|
2024-11-13 23:56:43 +01:00
|
|
|
urls = ["https://digitalprojects.wpi.art/monet/artworks"]
|
|
|
|
hrefs = []
|
|
|
|
|
2024-11-12 05:16:21 +01:00
|
|
|
|
|
|
|
def main():
|
2024-11-13 23:56:43 +01:00
|
|
|
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!")
|
2024-11-12 05:16:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|