1
0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2024-12-22 13:06:59 +00:00

Add ggpht proxy (channel-related images)

This commit is contained in:
Cadence Ember 2021-01-15 01:07:05 +13:00
parent 8a0fb5cf21
commit adb5dc93d5
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17

View File

@ -1,15 +1,7 @@
import configuration
import cherrypy
import json
import youtube_dlc
import datetime
import dateutil.parser
import os
import re
import json
import traceback
import requests
import xml.etree.ElementTree as ET
import youtube_dlc
from extractors.video import extract_video
from extractors.channel import extract_channel, extract_channel_videos, extract_channel_latest
from extractors.manifest import extract_manifest
@ -106,6 +98,13 @@ class Second(object):
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.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.quickstart(Second(), "/", {
"/": {