site list changes (#872)

* site list changes
- made site-list.json automatically create providers.json
- removed site list from readme (now shows a link)
- remove jquery dependency and split src into multiple files

* update workflow file

* oops wrong number

* fix invalid regex

* status 1

* revert providers.json
This commit is contained in:
Cloudburst 2022-04-12 18:48:50 +02:00 committed by GitHub
parent e05f8d0f3a
commit 1db8f98391
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 139 additions and 212 deletions

77
.github/site-list.py vendored
View file

@ -1,63 +1,54 @@
#!/usr/bin/python3
from glob import glob
from re import findall, compile, sub, DOTALL
from re import findall, compile, DOTALL
from json import dump, load
from typing import List, Dict
# Globals
URL_REGEX = compile(
"override\sva[lr]\smainUrl[^\"']+[\"'](https?://[a-zA-Z0-9\.-]+)[\"']")
NAME_REGEX = compile("class (.+?) ?: \w+\(\)\s\{")
START_MARKER = "<!--SITE LIST START-->"
END_MARKER = "<!--SITE LIST END-->"
NAME_REGEX = compile("([A-Za-z0-9]+)(?:.kt)$")
JSON_PATH = "docs/providers.json"
GLOB = "app/src/main/java/com/lagradost/cloudstream3/*providers/*Provider.kt"
MAIN_API = "app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt"
API_REGEX = compile(
"val\s*allProviders.*?{\s.*?arrayListOf\(([\W\w]*?)\)\s*\n*\s*}", DOTALL)
sites: Dict[str, str] = {}
enabled_sites: List[str] = []
with open(MAIN_API, "r", encoding="utf-8") as f:
apis = findall(API_REGEX, f.read())
for api_list in apis:
for api in api_list.split("\n"):
if not api.strip() or api.strip().startswith("/"):
continue
enabled_sites.append(api.strip().split("(")[0])
old_sites: Dict[str, Dict] = load(open(JSON_PATH, "r", encoding="utf-8"))
sites: Dict[str, Dict] = {}
# parse all *Provider.kt files
for path in glob(GLOB):
with open(path, "r", encoding='utf-8') as file:
try:
site_text: str = file.read()
name: List[str] = findall(NAME_REGEX, site_text)
provider_text: str = findall(URL_REGEX, site_text)
name: str = findall(NAME_REGEX, path)[0]
provider_url: str = [*findall(URL_REGEX, site_text), ""][0]
if name:
if name[0] not in enabled_sites:
continue
sites[name[0]] = provider_text[0]
if name in old_sites.keys(): # if already in previous list use old status and name
sites[name] = {
"name": old_sites[name]['name'],
"url": provider_url if provider_url else old_sites[name]['url'],
"status": old_sites[name]['status']
}
else: # if not in previous list add with new data
display_name = name
if display_name.endswith("Provider"):
display_name = display_name[:-len("Provider")]
sites[name] = {
"name": display_name,
"url": provider_url if provider_url else "",
"status": 1
}
except Exception as ex:
print("{0}: {1}".format(path, ex))
# add sites from old_sites that are missing in new list
for name in old_sites.keys():
if name not in sites.keys():
sites[name] = {
"name": old_sites[name]['name'],
"url": old_sites[name]['url'],
"status": old_sites[name]['status']
}
with open("README.md", "r+", encoding='utf-8') as readme:
raw = readme.read()
if START_MARKER not in raw or END_MARKER not in raw:
raise RuntimeError("Missing start and end markers")
readme.seek(0)
readme.write(raw.split(START_MARKER)[0])
readme.write(START_MARKER+"\n")
for site in enabled_sites:
if site in sites:
readme.write(
"- [{0}]({1}) \n".format(sub("^https?://(?:www\.)?", "", sites[site]), sites[site]))
readme.write(END_MARKER)
readme.write(raw.split(END_MARKER)[-1])
readme.truncate()
dump(sites, open(JSON_PATH, "w+", encoding="utf-8"), indent=4, sort_keys=True)

View file

@ -4,10 +4,10 @@ on:
push:
branches: [ master ]
paths:
- 'README.md'
- 'app/src/main/java/com/lagradost/cloudstream3/*providers/*Provider.kt'
- '.github/workflows/site_list.yml'
- '.github/site-list.py'
- 'docs/providers.json'
- 'app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt'
concurrency:
@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Edit README.md
- name: Edit providers.json
run: |
python3 .github/site-list.py
- name: Commit to the repo

View file

@ -58,53 +58,5 @@ It merely scrapes 3rd-party websites that are publicly accessable via any regula
***Sites used:***
https://lagradost.github.io/CloudStream-3/
<!-- Do not remove those two comments -->
<!--SITE LIST START-->
- [pelisplus.icu](https://pelisplus.icu)
- [pelismart.com](https://pelismart.com)
- [melomovie.com](https://melomovie.com)
- [doramasyt.com](https://doramasyt.com)
- [cuevana3.me](https://cuevana3.me)
- [pelisflix.li](https://pelisflix.li)
- [seriesflix.video](https://seriesflix.video)
- [ihavenotv.com](https://ihavenotv.com)
- [lookmovie.io](https://lookmovie.io)
- [vmovee.watch](https://www.vmovee.watch)
- [allmoviesforyou.net](https://allmoviesforyou.net)
- [vidembed.cc](https://vidembed.cc)
- [vf-film.me](https://vf-film.me)
- [vf-serie.org](https://vf-serie.org)
- [asianembed.io](https://asianembed.io)
- [asiaflix.app](https://asiaflix.app)
- [fmovies.to](https://fmovies.to)
- [filman.cc](https://filman.cc)
- [dopebox.to](https://dopebox.to)
- [pinoymoviepedia.ru](https://pinoymoviepedia.ru)
- [pinoy-hd.xyz](https://www.pinoy-hd.xyz)
- [pinoymovies.es](https://pinoymovies.es)
- [trailers.to](https://trailers.to)
- [2embed.ru](https://www.2embed.ru)
- [dramasee.net](https://dramasee.net)
- [watchasian.sh](https://watchasian.sh)
- [kdramahood.com](https://kdramahood.com)
- [akwam.to](https://akwam.to)
- [mycima.tv](https://mycima.tv)
- [egy.best](https://www.egy.best)
- [hdm.to](https://hdm.to)
- [theflix.to](https://theflix.to)
- [v2.apimdb.net](https://v2.apimdb.net)
- [wcostream.com](https://www.wcostream.com)
- [gogoanime.film](https://gogoanime.film)
- [allanime.site](https://allanime.site)
- [animekisa.in](https://animekisa.in)
- [animeflick.net](https://animeflick.net)
- [tenshi.moe](https://tenshi.moe)
- [wcostream.cc](https://wcostream.cc)
- [9anime.id](https://9anime.id)
- [animeworld.tv](https://www.animeworld.tv)
- [zoro.to](https://zoro.to)
- [bestdubbedanime.com](https://bestdubbedanime.com)
- [monoschinos2.com](https://monoschinos2.com)
- [kawaiifu.com](https://kawaiifu.com)
<!--SITE LIST END-->
Look [here](https://lagradost.github.io/CloudStream-3/) for a comprehensive list

View file

@ -7,131 +7,17 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<title>CloudStream-3 Supported Sites</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<style>
body {
font-family: "Roboto", sans-serif;
background-color: #FFF;
}
.whiteText {
color : #FFF;
}
.button {
color : #000;
text-decoration: none;
}
.redButton {
}
.blueButton {
}
.greenButton {
}
.yellowButton {
}
.row {
padding: 0px 10px;
white-space: nowrap;
}
table {
border-spacing: 0.5rem;
}
.yellowButton::before {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-6.62744-5.3726-12-12-12-6.62744 0-12 5.37256-12 12 0 6.6274 5.37256 12 12 12zm0-17.5c.4141 0 .75.33582.75.75v4.5c0 .4142-.3359.75-.75.75s-.75-.3358-.75-.75v-4.5c0-.41418.3359-.75.75-.75zm.8242 9.5658c.0635-.0919.1118-.195.1416-.3054.0132-.0482.0225-.0979.0283-.1487.0039-.0366.0059-.074.0059-.1117 0-.5522-.4478-1-1-1s-1 .4478-1 1 .4478 1 1 1c.3423 0 .644-.172.8242-.4342z' fill='%23dbab09'/%3E%3C/svg%3e");
}
.blueButton::before {
filter: sepia(100%) saturate(300%) brightness(70%) hue-rotate(180deg);
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-6.62744-5.3726-12-12-12-6.62744 0-12 5.37256-12 12 0 6.6274 5.37256 12 12 12zm0-17.5c.4141 0 .75.33582.75.75v4.5c0 .4142-.3359.75-.75.75s-.75-.3358-.75-.75v-4.5c0-.41418.3359-.75.75-.75zm.8242 9.5658c.0635-.0919.1118-.195.1416-.3054.0132-.0482.0225-.0979.0283-.1487.0039-.0366.0059-.074.0059-.1117 0-.5522-.4478-1-1-1s-1 .4478-1 1 .4478 1 1 1c.3423 0 .644-.172.8242-.4342z' fill='%23dbab09'/%3E%3C/svg%3e");
}
.redButton::before {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-6.62744-5.3726-12-12-12-6.62744 0-12 5.37256-12 12 0 6.6274 5.37256 12 12 12zm0-17.5c.4141 0 .75.33582.75.75v4.5c0 .4142-.3359.75-.75.75s-.75-.3358-.75-.75v-4.5c0-.41418.3359-.75.75-.75zm.8242 9.5658c.0635-.0919.1118-.195.1416-.3054.0132-.0482.0225-.0979.0283-.1487.0039-.0366.0059-.074.0059-.1117 0-.5522-.4478-1-1-1s-1 .4478-1 1 .4478 1 1 1c.3423 0 .644-.172.8242-.4342z' fill='%23d73a49'/%3E%3C/svg%3e");
}
.greenButton::before{
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='15' height='15' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m1 12c0-6.07513 4.92487-11 11-11 6.0751 0 11 4.92487 11 11 0 6.0751-4.9249 11-11 11-6.07513 0-11-4.9249-11-11zm16.2803-2.71967c.2929-.29289.2929-.76777 0-1.06066s-.7677-.29289-1.0606 0l-5.9697 5.96963-2.46967-2.4696c-.29289-.2929-.76777-.2929-1.06066 0s-.29289.7677 0 1.0606l3 3c.29293.2929.76773.2929 1.06063 0z' fill='%2328a745'/%3E%3C/svg%3e");ontent: '';
}
.indicator::before {
display: inline-block;
width: 24px;
height: 24px;
content: "";
vertical-align: text-bottom;
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center center;
margin-right:10px;
}
</style>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div>
<h1>Site supported:</h1>
<h1>Sites supported (<span id="count">0</span>):</h1>
<table>
<tbody id="siteList"></tbody>
</table>
</div>
<script>
var status = document.getElementById("status");
var mainContainer = document.getElementById("siteList");
$(document).ready(function () {
$.getJSON("providers.json", function (data) {
status.innerHTML = "Parsing...";
for (var key in data) {
status.innerHTML = "Reading..." + key;
if (data.hasOwnProperty(key)) {
var value = data[key];
if(value.url == "NONE") { continue; }
var _status = value.status
var node = document.createElement("tr");
node.classList.add("row");
var _a = document.createElement("a");
_a.setAttribute('href', value.url);
_a.innerHTML = value.name
var _statusText = "Unknown";
var _buttonText = "yellow";
switch (_status) {
case 0:
_statusText = "Unavailable";
_buttonText = "red";
break;
case 1:
_statusText = "Available";
_buttonText = "green";
break;
case 2:
_statusText = "Slow";
_buttonText = "yellow";
break;
case 3:
_statusText = "Beta";
_buttonText = "blue";
break;
}
_a.classList.add(_buttonText+"Button");
_a.classList.add("indicator");
_a.classList.add("button");
node.appendChild(_a);
mainContainer.appendChild(node);
}
}
}).fail(function () {
console.log("An error has occurred.");
});
});
</script>
<script src="/script.js" type="text/javascript"></script>
</body>
</html>

49
docs/script.js Normal file
View file

@ -0,0 +1,49 @@
const count = document.getElementById("count")
const mainContainer = document.getElementById("siteList");
fetch("/providers.json" + "?v=" + Date.now())
.then(r => r.json())
.then(function (data) {
count.innerHTML = Object.keys(data).length;
for (var key in data) {
if (data.hasOwnProperty(key)) {
var value = data[key];
if (value.url == "NONE") { continue; }
var _status = value.status
var node = document.createElement("tr");
node.classList.add("row");
var _a = document.createElement("a");
_a.setAttribute('href', value.url);
_a.innerHTML = value.name
var _statusText = "Unknown";
var _buttonText = "yellow";
switch (_status) {
case 0:
_statusText = "Unavailable";
_buttonText = "red";
break;
case 1:
_statusText = "Available";
_buttonText = "green";
break;
case 2:
_statusText = "Slow";
_buttonText = "yellow";
break;
case 3:
_statusText = "Beta";
_buttonText = "blue";
break;
}
_a.classList.add(_buttonText + "Button");
_a.classList.add("indicator");
_a.classList.add("button");
node.appendChild(_a);
mainContainer.appendChild(node);
}
}
})

49
docs/style.css Normal file
View file

@ -0,0 +1,49 @@
body {
font-family: "Roboto", sans-serif;
background-color: #FFF;
}
.whiteText {
color : #FFF;
}
.button {
color : #000;
text-decoration: none;
}
.row {
padding: 0px 10px;
white-space: nowrap;
}
table {
border-spacing: 0.5rem;
}
.yellowButton::before {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-6.62744-5.3726-12-12-12-6.62744 0-12 5.37256-12 12 0 6.6274 5.37256 12 12 12zm0-17.5c.4141 0 .75.33582.75.75v4.5c0 .4142-.3359.75-.75.75s-.75-.3358-.75-.75v-4.5c0-.41418.3359-.75.75-.75zm.8242 9.5658c.0635-.0919.1118-.195.1416-.3054.0132-.0482.0225-.0979.0283-.1487.0039-.0366.0059-.074.0059-.1117 0-.5522-.4478-1-1-1s-1 .4478-1 1 .4478 1 1 1c.3423 0 .644-.172.8242-.4342z' fill='%23dbab09'/%3E%3C/svg%3e");
}
.blueButton::before {
filter: sepia(100%) saturate(300%) brightness(70%) hue-rotate(180deg);
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-6.62744-5.3726-12-12-12-6.62744 0-12 5.37256-12 12 0 6.6274 5.37256 12 12 12zm0-17.5c.4141 0 .75.33582.75.75v4.5c0 .4142-.3359.75-.75.75s-.75-.3358-.75-.75v-4.5c0-.41418.3359-.75.75-.75zm.8242 9.5658c.0635-.0919.1118-.195.1416-.3054.0132-.0482.0225-.0979.0283-.1487.0039-.0366.0059-.074.0059-.1117 0-.5522-.4478-1-1-1s-1 .4478-1 1 .4478 1 1 1c.3423 0 .644-.172.8242-.4342z' fill='%23dbab09'/%3E%3C/svg%3e");
}
.redButton::before {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-6.62744-5.3726-12-12-12-6.62744 0-12 5.37256-12 12 0 6.6274 5.37256 12 12 12zm0-17.5c.4141 0 .75.33582.75.75v4.5c0 .4142-.3359.75-.75.75s-.75-.3358-.75-.75v-4.5c0-.41418.3359-.75.75-.75zm.8242 9.5658c.0635-.0919.1118-.195.1416-.3054.0132-.0482.0225-.0979.0283-.1487.0039-.0366.0059-.074.0059-.1117 0-.5522-.4478-1-1-1s-1 .4478-1 1 .4478 1 1 1c.3423 0 .644-.172.8242-.4342z' fill='%23d73a49'/%3E%3C/svg%3e");
}
.greenButton::before{
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='15' height='15' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m1 12c0-6.07513 4.92487-11 11-11 6.0751 0 11 4.92487 11 11 0 6.0751-4.9249 11-11 11-6.07513 0-11-4.9249-11-11zm16.2803-2.71967c.2929-.29289.2929-.76777 0-1.06066s-.7677-.29289-1.0606 0l-5.9697 5.96963-2.46967-2.4696c-.29289-.2929-.76777-.2929-1.06066 0s-.29289.7677 0 1.0606l3 3c.29293.2929.76773.2929 1.06063 0z' fill='%2328a745'/%3E%3C/svg%3e");ontent: '';
}
.indicator::before {
display: inline-block;
width: 24px;
height: 24px;
content: "";
vertical-align: text-bottom;
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center center;
margin-right:10px;
}