Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,11 +17,12 @@ def get_data(id):
|
|
| 17 |
def get_video_data(id):
|
| 18 |
if not id:
|
| 19 |
return gr.Dropdown(choices=[]), {}
|
| 20 |
-
|
| 21 |
res = requests.get('https://net52.cc/pv/playlist.php', {'id': id}).json()[0]
|
|
|
|
|
|
|
| 22 |
data = {
|
| 23 |
-
"subtitle": [i['label'] for i in res.get('tracks', [])],
|
| 24 |
-
"quality": {i.stream_info.resolution[1]: i.uri for i in m3u8.load(f'https://net52.cc/pv/hls/{id}.m3u8?in={
|
| 25 |
}
|
| 26 |
q = list(data['quality'].keys())
|
| 27 |
print(q)
|
|
@@ -30,7 +31,7 @@ def get_video_data(id):
|
|
| 30 |
def on_quality_change(quality, video_state):
|
| 31 |
if not video_state or not quality: # Bug fix: None check
|
| 32 |
return ""
|
| 33 |
-
return video_state['quality'].get(quality, "")
|
| 34 |
|
| 35 |
with gr.Blocks() as demo:
|
| 36 |
input_text = gr.Textbox(
|
|
|
|
| 17 |
def get_video_data(id):
|
| 18 |
if not id:
|
| 19 |
return gr.Dropdown(choices=[]), {}
|
|
|
|
| 20 |
res = requests.get('https://net52.cc/pv/playlist.php', {'id': id}).json()[0]
|
| 21 |
+
# in_data = parse_qs(urlparse(res['sources'][0]['file']).query)['in'][0]
|
| 22 |
+
in_data = "66bd26b7e7bdd26a0ad2493aed334a24::9857fca9697cf8934e0e23aa701e8651::1770730664::ni"
|
| 23 |
data = {
|
| 24 |
+
"subtitle": [i['label'] for i in res.get('tracks', [])],
|
| 25 |
+
"quality": {i.stream_info.resolution[1]: i.uri for i in m3u8.load(f'https://net52.cc/pv/hls/{id}.m3u8?in={in_data}').playlists}
|
| 26 |
}
|
| 27 |
q = list(data['quality'].keys())
|
| 28 |
print(q)
|
|
|
|
| 31 |
def on_quality_change(quality, video_state):
|
| 32 |
if not video_state or not quality: # Bug fix: None check
|
| 33 |
return ""
|
| 34 |
+
return video_state['quality'].get(quality, "")
|
| 35 |
|
| 36 |
with gr.Blocks() as demo:
|
| 37 |
input_text = gr.Textbox(
|