diff --git a/.gitignore b/.gitignore index f741989..c1d9319 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .venv .env -**/.DS_Store \ No newline at end of file +**/.DS_Store +__pycache__ \ No newline at end of file diff --git a/main.py b/main.py index 4a0fc0b..fe5e0d6 100644 --- a/main.py +++ b/main.py @@ -1 +1,18 @@ from urllib import request +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +def read_root(): + return get_cliff() + + +def get_cliff(): + r = request.Request('https://www.creators.com/read/heathcliff', headers={'User-Agent': 'Mozilla/5.0'}) + html = request.urlopen(r).read().decode("utf8") + + urlStart = html.index('https://cdn.alphacomedy.com') + imageUrl = html[urlStart:].split("\"")[0] + + return imageUrl \ No newline at end of file