18 lines
433 B
Python
18 lines
433 B
Python
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 |