mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-13 03:47:28 +00:00
Add thumbnail proxy
This commit is contained in:
parent
84dd940ac4
commit
582a19bd1f
8
index.py
8
index.py
@ -6,6 +6,7 @@ import os
|
||||
import re
|
||||
import json
|
||||
import traceback
|
||||
import requests
|
||||
|
||||
ytdl_opts = {
|
||||
"quiet": True,
|
||||
@ -294,5 +295,12 @@ class Second(object):
|
||||
"isUpcoming": None
|
||||
} for video in info["entries"] if "title" in video)
|
||||
|
||||
@cherrypy.expose
|
||||
def vi(self, id, file):
|
||||
with requests.get("https://i.ytimg.com/vi/{}/{}".format(id, file)) as r:
|
||||
r.raise_for_status()
|
||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||
return r # no idea if this is a good way to do it, but it definitely works! :D
|
||||
|
||||
cherrypy.config.update({"server.socket_port": 3000})
|
||||
cherrypy.quickstart(Second())
|
||||
|
Loading…
Reference in New Issue
Block a user