diff --git a/Dockerfile b/Dockerfile index a2f41f5..5476a25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ COPY ["backend/start.sh", "/app/start.sh"] COPY ["backend/sources.py", "/app/setup/sources.py"] COPY ["backend/style.js", "/app/setup/style.js"] COPY ["backend/stream.py", "/app/stream.py"] +COPY ["backend/seafile.js", "/app/seafile.js"] COPY ["backend/stream_providers.py", "/app/stream_providers.py"] COPY ["frontend/index.html", "/app/index.html"] COPY ["frontend/favicon.svg", "/app/favicon.svg"] diff --git a/backend/seafile.js b/backend/seafile.js new file mode 100644 index 0000000..b45d808 --- /dev/null +++ b/backend/seafile.js @@ -0,0 +1,51 @@ +#!/usr/bin/env node +const esprima = require('esprima'); +const cheerio = require('cheerio'); +const axios = require('axios'); + +let url = null; + +for(let i=0; i { + const dom = cheerio.load(resp.data, {xmlMode: false}); + const tags = dom('script').get(); + const data = {}; + let props = []; + for(let i=0; i", u'\u1354').replace("'", '"') - text = re.sub(quote_add_expr, r'"\1":', text) - text = re.sub(optional_expr, "", text) - text = re.sub(comment_expr, "", text) - for func in re.findall(func_expr, text): - text = text.replace(func, '0,"') - json_data_src = [] - for res in re.findall(expr, text): - try: - json_data_src.append(json.loads(res)) - except Exception as e: - self.logger.info("%s <%s>", e, self.upstream) - json_data = dict() - for elem in json_data_src: - for k,v in elem.items(): - if hasattr(v, "__len__") and len(v) > 0: - json_data[k] = v - stream_data["title"] = json_data.get("filePath") - stream_data["upstream"] = json_data.get("rawPath") + json_data = json.loads(proc.stdout) except Exception as e: self.logger.info("%s <%s>", e, self.upstream) + else: + stream_data["title"] = json_data.get("filePath") + stream_data["upstream"] = json_data.get("rawPath") return StreamData(**stream_data) class MetaProvider(StreamProvider):