first commit
This commit is contained in:
commit
f1e23b4a48
16
.drone.yml
Normal file
16
.drone.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
repo:
|
||||||
|
from_secret: docker_repo
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- ${DRONE_BUILD_FINISHED}
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.pyc
|
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM alpine:edge as base
|
||||||
|
RUN ["apk", "add", "--no-cache", "streamlink"]
|
||||||
|
RUN ["mkdir", "/app"]
|
||||||
|
COPY ["stream.py", "/app/stream.py"]
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=base / /
|
||||||
|
|
||||||
|
USER 1444:1444
|
||||||
|
ENTRYPOINT ["/app/stream.py"]
|
30
stream.py
Executable file
30
stream.py
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import streamlink
|
||||||
|
import tornado.web
|
||||||
|
import tornado.routing
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
|
providers = {}
|
||||||
|
providers["nrk"] = "https://tv.nrk.no"
|
||||||
|
providers["svt"] = "https://svtplay.se"
|
||||||
|
providers["youtube"] = "https://youtu.be"
|
||||||
|
|
||||||
|
class MainHandler(tornado.web.RequestHandler):
|
||||||
|
def get(self):
|
||||||
|
provider = self.get_query_argument("provider", None)
|
||||||
|
if provider in providers:
|
||||||
|
endpoint = None
|
||||||
|
src = providers[provider] + self.request.uri
|
||||||
|
try:
|
||||||
|
endpoint = streamlink.streams(src).get("best").url
|
||||||
|
except Exception as e:
|
||||||
|
self.write(str(e))
|
||||||
|
else:
|
||||||
|
self.redirect(endpoint, status=303)
|
||||||
|
try:
|
||||||
|
app_web = tornado.web.Application([(tornado.routing.AnyMatches(), MainHandler)])
|
||||||
|
app_web.listen(8080)
|
||||||
|
tornado.ioloop.IOLoop.current().start()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user