* test on devrama

* fix prev commit

* fix prev commit

* try some shit

* try some shit

* try some shit

* fix

* make it easier to change notif colors with custom css

* de

* t

* fgddfg

* fds

* fix

* fds

* dfs

* pain

* sdfsdf

* df

* xcv

* fd

* vxc

* xcv

* c

* fgdfgd

* sdf

* fsd

* fds

* sfd

* fdsf

* fd

* fds

* fds

* fsd

* fds

* fds

* fds

* fds

* fsd

* fds

* df

* fds

* dfs

* fd

* fsd

* fsd

* dfs

* sdf

* fsd

* fsd

* df

* dfs

* fd

* fsd

* dfs

* sdf

* sdf

* sdf

* fsd

* fds

* sfd

* sdf

* fds

* dfs

* df

* sdf

* sdf

* /live
master
Aevann1 2022-09-22 04:17:02 +02:00 committed by GitHub
parent ba063f2234
commit d55438afad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 100 additions and 1 deletions

View File

@ -433,4 +433,59 @@ if not os.path.exists(f'files/templates/donate_{SITE_NAME}.html'):
@app.get('/donate') @app.get('/donate')
@auth_required @auth_required
def donate(v): def donate(v):
return render_template(f'donate_{SITE_NAME}.html', v=v) return render_template(f'donate_{SITE_NAME}.html', v=v)
if SITE_NAME == 'PCM':
streamers = (
'UCJrqlqe8DBZsfdMu7gGrVRA',
'UCDDrY00FPYwLp9VqRhWiDgg',
'UCdBzv8yzRgvnxV1M95qOsNA',
'UCvRP7CKUHWTJamANqg8NCTQ',
'UCPtDuLhreIEcjJr7WWaNaUw',
'UCS8gM5S889oBPyN6K07ZC6A',
'UCUn24NHjc8asGiYet1P9h5Q',
'UCqdJpVkTPem_iKcoVqoZtAg',
'UCtcVe3ucfS-AZVcNc2GabPw',
'UCDk0PdOMRfknGhVE8R-S_DQ',
'UC0UFeYG5aSGZT2e8lOjQ7oA',
'UC1yC2i8t5ivhh5RsRpGWMlw',
'UCP_YnD-BO8ctnKgUW89Si6Q',
'UCoxFxZirbfLvy9tres71eSA',
'UClf1Wfw54YBjJNlX3NjSOPA',
'UC8X10knH1xD3PTeds8glyNw',
'UCgKTJAN-IrVyX-jIJ5INEhA',
'UCgjAbjJZgBCF3OVGkJV5kCw',
'UC7xWZT4HPMFYzFoijmH8POg',
'UCoBfUpZXvWjS995ZXCPxxVQ',
'UCoOh1fOZBN7uCc3qu-TTAJQ',
'UCo8wWQvRSoKL57vjv4vyXQw'
)
live_regex = re.compile('playerOverlayVideoDetailsRenderer":\{"title":\{"simpleText":"(.*?)"\},"subtitle":\{"runs":\[\{"text":"(.*?)"\},\{"text":""\},\{"text":"(.*?)"\}', flags=re.A)
live_thumb_regex = re.compile('\{"thumbnail":\{"thumbnails":\[\{"url":"(.*?)"', flags=re.A)
offline_regex = re.compile('","title":"(.*?)".*?"width":48,"height":48\},\{"url":"(.*?)"', flags=re.A)
@app.get('/live')
@app.get('/logged_out/live')
@auth_desired_with_logingate
def live(v):
live = []
offline = []
for x in streamers:
url = f'https://www.youtube.com/channel/{x}/live'
req = requests.get(url, cookies={'CONSENT': 'YES+1'}, proxies=proxies)
txt = req.text
if '"videoDetails":{"videoId"' in txt:
t = live_thumb_regex.search(txt)
y = live_regex.search(txt)
try:
count = int(y.group(3))
live.append((req.url, t.group(1), y.group(2), y.group(1), count))
except:
offline.append((req.url, t.group(1), y.group(2)))
else:
y = offline_regex.search(txt)
offline.append((req.url, y.group(2), y.group(1)))
return render_template(f'live.html', v=v, live=live, offline=offline)

View File

@ -0,0 +1,44 @@
{% extends "default.html" %}
{% block title %}
<title>{{SITE_NAME}} - Live</title>
{% endblock %}
{% block content %}
<style>
tr:hover {
border: 2.5px solid var(--primary);
}
</style>
<h1 class="py-3">Live</h1>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<tbody>
{% for link, thumb, name, title, viewers in live %}
<tr onclick="window.open('{{link}}', '_blank')">
<td width="48"><img src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td>{{name}}</td>
<td>{{title}}</td>
<td>{{viewers}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<h1 class="py-3">Offline</h1>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<tbody>
{% for link, thumb, name in offline %}
<tr onclick="window.open('{{link}}', '_blank')">
<td width="48"><img src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td>{{name}}</td>
<td></td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}