Skip to content

Commit

Permalink
Proxy stream requests using HTTPServer anxdpanic#527 anxdpanic#1040
Browse files Browse the repository at this point in the history
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
  • Loading branch information
MoojMidge committed Jan 4, 2025
1 parent 74e91ac commit 93c9250
Show file tree
Hide file tree
Showing 8 changed files with 769 additions and 542 deletions.
5 changes: 3 additions & 2 deletions resources/lib/youtube_plugin/kodion/compatibility/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
__all__ = (
'BaseHTTPRequestHandler',
'TCPServer',
'ThreadingMixIn',
'available_cpu_count',
'byte_string_type',
'datetime_infolabel',
Expand All @@ -36,7 +37,7 @@
try:
from html import unescape
from http.server import BaseHTTPRequestHandler
from socketserver import TCPServer
from socketserver import TCPServer, ThreadingMixIn
from urllib.parse import (
parse_qs,
parse_qsl,
Expand Down Expand Up @@ -77,7 +78,7 @@ def entity_escape(text,
except ImportError:
from BaseHTTPServer import BaseHTTPRequestHandler
from contextlib import contextmanager as _contextmanager
from SocketServer import TCPServer
from SocketServer import TCPServer, ThreadingMixIn
from urllib import (
quote as _quote,
unquote as _unquote,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@
MPD = '/youtube/manifest/dash'
PING = '/youtube/ping'
REDIRECT = '/youtube/redirect'
STREAM_PROXY = '/youtube/stream'
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def shutdown_httpd(self, on_idle=False, terminate=False, player=None):
if not thread.is_alive():
continue
try:
thread.join(5)
thread.join(2)
except RuntimeError:
pass

Expand Down
Loading

0 comments on commit 93c9250

Please sign in to comment.