Add heathcliff scraping code
This commit is contained in:
parent
997aaa4984
commit
ef0a97589e
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.venv
|
.venv
|
||||||
.env
|
.env
|
||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
|
__pycache__
|
17
main.py
17
main.py
@ -1 +1,18 @@
|
|||||||
from urllib import request
|
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
|
Loading…
x
Reference in New Issue
Block a user