mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-22 15:47:30 +00:00
Compare commits
No commits in common. "73b4fbabf7c5f46975ebc69cc3d2a66600e98514" and "66b7d1bec87ad152728c8312ed3d3964f7dade16" have entirely different histories.
73b4fbabf7
...
66b7d1bec8
@ -29,11 +29,6 @@ def extract_channel(ucid):
|
|||||||
"error": alert_text,
|
"error": alert_text,
|
||||||
"identifier": "NOT_FOUND"
|
"identifier": "NOT_FOUND"
|
||||||
}
|
}
|
||||||
elif alert_text.startswith("This account has been terminated"):
|
|
||||||
return {
|
|
||||||
"error": alert_text,
|
|
||||||
"identifier": "ACCOUNT_TERMINATED"
|
|
||||||
}
|
|
||||||
else:
|
else:
|
||||||
print("Seen alert text '{}'".format(alert_text))
|
print("Seen alert text '{}'".format(alert_text))
|
||||||
|
|
||||||
|
8
index.py
8
index.py
@ -123,17 +123,17 @@ class NewLeaf(object):
|
|||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def vi(self, id, file):
|
def vi(self, id, file):
|
||||||
with requests.get("https://i.ytimg.com/vi/{}/{}".format(id, file), stream=True) as r:
|
with requests.get("https://i.ytimg.com/vi/{}/{}".format(id, file)) as r:
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||||
return next(r.iter_content(chunk_size=None))
|
return r # no idea if this is a good way to do it, but it definitely works! :D
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def ggpht(self, *path):
|
def ggpht(self, *path):
|
||||||
with requests.get("https://yt3.ggpht.com/{}".format("/".join(path)), stream=True) as r:
|
with requests.get("https://yt3.ggpht.com/{}".format("/".join(path))) as r:
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||||
return next(r.iter_content(chunk_size=None))
|
return r
|
||||||
|
|
||||||
bind_port = getattr(configuration, "bind_port", 3000)
|
bind_port = getattr(configuration, "bind_port", 3000)
|
||||||
bind_host = getattr(configuration, "bind_host", "0.0.0.0")
|
bind_host = getattr(configuration, "bind_host", "0.0.0.0")
|
||||||
|
Loading…
Reference in New Issue
Block a user