mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-22 07:37:29 +00:00
Add ggpht proxy (channel-related images)
This commit is contained in:
parent
8a0fb5cf21
commit
adb5dc93d5
17
index.py
17
index.py
@ -1,15 +1,7 @@
|
|||||||
import configuration
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
import json
|
import json
|
||||||
import youtube_dlc
|
|
||||||
import datetime
|
|
||||||
import dateutil.parser
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import json
|
|
||||||
import traceback
|
|
||||||
import requests
|
import requests
|
||||||
import xml.etree.ElementTree as ET
|
import youtube_dlc
|
||||||
from extractors.video import extract_video
|
from extractors.video import extract_video
|
||||||
from extractors.channel import extract_channel, extract_channel_videos, extract_channel_latest
|
from extractors.channel import extract_channel, extract_channel_videos, extract_channel_latest
|
||||||
from extractors.manifest import extract_manifest
|
from extractors.manifest import extract_manifest
|
||||||
@ -106,6 +98,13 @@ class Second(object):
|
|||||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
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
|
return r # no idea if this is a good way to do it, but it definitely works! :D
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
def ggpht(self, *path):
|
||||||
|
with requests.get("https://yt3.ggpht.com/{}".format("/".join(path))) as r:
|
||||||
|
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||||
|
r.raise_for_status()
|
||||||
|
return r
|
||||||
|
|
||||||
cherrypy.config.update({"server.socket_port": 3000, "server.socket_host": "0.0.0.0"})
|
cherrypy.config.update({"server.socket_port": 3000, "server.socket_host": "0.0.0.0"})
|
||||||
cherrypy.quickstart(Second(), "/", {
|
cherrypy.quickstart(Second(), "/", {
|
||||||
"/": {
|
"/": {
|
||||||
|
Loading…
Reference in New Issue
Block a user