Spaces:
Running
Running
admin
commited on
Commit
·
bf7d327
1
Parent(s):
0d11e5e
sync ms
Browse files- app.py +2 -2
- modules/bili.py +2 -2
- modules/bvid2acid.py +2 -2
- modules/tiktok.py +8 -8
- utils.py +1 -1
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from modules.tiktok import tiktok_parser
|
3 |
from modules.bili import bili_parser
|
4 |
from modules.bvid2acid import bv2acid
|
5 |
-
from utils import
|
6 |
|
7 |
ZH2EN = {
|
8 |
"本站不提供任何视频存储服务,仅提供最基本的解析服务,请勿滥用": "This site does not provide any audio storage services, only provide the most basic parsing services, please DO NOT abuse",
|
@@ -12,7 +12,7 @@ ZH2EN = {
|
|
12 |
|
13 |
|
14 |
def _L(zh_txt: str):
|
15 |
-
return ZH2EN[zh_txt] if
|
16 |
|
17 |
|
18 |
if __name__ == "__main__":
|
|
|
2 |
from modules.tiktok import tiktok_parser
|
3 |
from modules.bili import bili_parser
|
4 |
from modules.bvid2acid import bv2acid
|
5 |
+
from utils import EN_US
|
6 |
|
7 |
ZH2EN = {
|
8 |
"本站不提供任何视频存储服务,仅提供最基本的解析服务,请勿滥用": "This site does not provide any audio storage services, only provide the most basic parsing services, please DO NOT abuse",
|
|
|
12 |
|
13 |
|
14 |
def _L(zh_txt: str):
|
15 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
16 |
|
17 |
|
18 |
if __name__ == "__main__":
|
modules/bili.py
CHANGED
@@ -8,7 +8,7 @@ from utils import (
|
|
8 |
API_BILI,
|
9 |
API_BILI_2,
|
10 |
API_BILI_1,
|
11 |
-
|
12 |
TMP_DIR,
|
13 |
)
|
14 |
|
@@ -31,7 +31,7 @@ ZH2EN = {
|
|
31 |
|
32 |
|
33 |
def _L(zh_txt: str):
|
34 |
-
return ZH2EN[zh_txt] if
|
35 |
|
36 |
|
37 |
def get_fst_url(text):
|
|
|
8 |
API_BILI,
|
9 |
API_BILI_2,
|
10 |
API_BILI_1,
|
11 |
+
EN_US,
|
12 |
TMP_DIR,
|
13 |
)
|
14 |
|
|
|
31 |
|
32 |
|
33 |
def _L(zh_txt: str):
|
34 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
35 |
|
36 |
|
37 |
def get_fst_url(text):
|
modules/bvid2acid.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
-
from utils import
|
4 |
|
5 |
ZH2EN = {
|
6 |
"状态栏": "Status",
|
@@ -9,7 +9,7 @@ ZH2EN = {
|
|
9 |
|
10 |
|
11 |
def _L(zh_txt: str):
|
12 |
-
return ZH2EN[zh_txt] if
|
13 |
|
14 |
|
15 |
def infer(bvid: str):
|
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
+
from utils import EN_US, HEADER
|
4 |
|
5 |
ZH2EN = {
|
6 |
"状态栏": "Status",
|
|
|
9 |
|
10 |
|
11 |
def _L(zh_txt: str):
|
12 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
13 |
|
14 |
|
15 |
def infer(bvid: str):
|
modules/tiktok.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
-
from utils import download_file, extract_fst_url, API_TIKTOK, TIMEOUT,
|
4 |
|
5 |
ZH2EN = {
|
6 |
"状态栏": "Status",
|
@@ -12,16 +12,16 @@ ZH2EN = {
|
|
12 |
"作者昵称": "Author nickname",
|
13 |
"作者签名": "Author signature",
|
14 |
"抖音无水印视频解析": "Parse TikTok video without watermark",
|
15 |
-
"
|
16 |
}
|
17 |
|
18 |
|
19 |
def _L(zh_txt: str):
|
20 |
-
return ZH2EN[zh_txt] if
|
21 |
|
22 |
|
23 |
# outer func
|
24 |
-
def infer(
|
25 |
status = "Success"
|
26 |
video = parse_time = desc = avatar = author = sign = None
|
27 |
try:
|
@@ -44,7 +44,7 @@ def infer(direct_link, video_url, cache=f"{TMP_DIR}/tiktok"):
|
|
44 |
author = additional_data["nickname"]
|
45 |
sign = additional_data["signature"]
|
46 |
|
47 |
-
if
|
48 |
video = response_data["video_url"]
|
49 |
else:
|
50 |
video_id = response_data["play_url"].split("video_id=")[1].split("&")[0]
|
@@ -63,11 +63,11 @@ def tiktok_parser():
|
|
63 |
return gr.Interface(
|
64 |
fn=infer,
|
65 |
inputs=[
|
66 |
-
gr.Checkbox(label=_L("直链"), value=False),
|
67 |
gr.Textbox(
|
68 |
label=_L("请输入抖音视频分享短链接"),
|
69 |
placeholder="https://v.douyin.com/*",
|
70 |
),
|
|
|
71 |
],
|
72 |
outputs=[
|
73 |
gr.Textbox(label=_L("状态栏"), show_copy_button=True),
|
@@ -85,10 +85,10 @@ def tiktok_parser():
|
|
85 |
title=_L("抖音无水印视频解析"),
|
86 |
flagging_mode="never",
|
87 |
examples=[
|
88 |
-
[
|
89 |
[
|
90 |
-
True,
|
91 |
"8.20 Njc:/ [email protected] 11/03 黑塔女士举世无双!# 大黑塔 # 黑塔 # 崩坏星穹铁道 # 再创世的凯歌 # 天才俱乐部 https://v.douyin.com/8FVe5DzarE0/ 复制此链接,打开Dou音搜索,直接观看视频!",
|
|
|
92 |
],
|
93 |
],
|
94 |
cache_examples=False,
|
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
+
from utils import download_file, extract_fst_url, API_TIKTOK, TIMEOUT, EN_US, TMP_DIR
|
4 |
|
5 |
ZH2EN = {
|
6 |
"状态栏": "Status",
|
|
|
12 |
"作者昵称": "Author nickname",
|
13 |
"作者签名": "Author signature",
|
14 |
"抖音无水印视频解析": "Parse TikTok video without watermark",
|
15 |
+
"直链输出": "Direct link output",
|
16 |
}
|
17 |
|
18 |
|
19 |
def _L(zh_txt: str):
|
20 |
+
return ZH2EN[zh_txt] if EN_US else zh_txt
|
21 |
|
22 |
|
23 |
# outer func
|
24 |
+
def infer(video_url: str, direct_lnk_out: bool, cache=f"{TMP_DIR}/tiktok"):
|
25 |
status = "Success"
|
26 |
video = parse_time = desc = avatar = author = sign = None
|
27 |
try:
|
|
|
44 |
author = additional_data["nickname"]
|
45 |
sign = additional_data["signature"]
|
46 |
|
47 |
+
if direct_lnk_out:
|
48 |
video = response_data["video_url"]
|
49 |
else:
|
50 |
video_id = response_data["play_url"].split("video_id=")[1].split("&")[0]
|
|
|
63 |
return gr.Interface(
|
64 |
fn=infer,
|
65 |
inputs=[
|
|
|
66 |
gr.Textbox(
|
67 |
label=_L("请输入抖音视频分享短链接"),
|
68 |
placeholder="https://v.douyin.com/*",
|
69 |
),
|
70 |
+
gr.Checkbox(label=_L("直链输出"), value=False),
|
71 |
],
|
72 |
outputs=[
|
73 |
gr.Textbox(label=_L("状态栏"), show_copy_button=True),
|
|
|
85 |
title=_L("抖音无水印视频解析"),
|
86 |
flagging_mode="never",
|
87 |
examples=[
|
88 |
+
["https://v.douyin.com/8FVe5DzarE0", False],
|
89 |
[
|
|
|
90 |
"8.20 Njc:/ [email protected] 11/03 黑塔女士举世无双!# 大黑塔 # 黑塔 # 崩坏星穹铁道 # 再创世的凯歌 # 天才俱乐部 https://v.douyin.com/8FVe5DzarE0/ 复制此链接,打开Dou音搜索,直接观看视频!",
|
91 |
+
True,
|
92 |
],
|
93 |
],
|
94 |
cache_examples=False,
|
utils.py
CHANGED
@@ -8,7 +8,7 @@ from zoneinfo import ZoneInfo
|
|
8 |
from tzlocal import get_localzone
|
9 |
|
10 |
|
11 |
-
|
12 |
API_TIKTOK = os.getenv("api_tiktok")
|
13 |
API_BILI = os.getenv("api_bili")
|
14 |
API_BILI_1 = os.getenv("api_bili_1")
|
|
|
8 |
from tzlocal import get_localzone
|
9 |
|
10 |
|
11 |
+
EN_US = os.getenv("LANG") != "zh_CN.UTF-8"
|
12 |
API_TIKTOK = os.getenv("api_tiktok")
|
13 |
API_BILI = os.getenv("api_bili")
|
14 |
API_BILI_1 = os.getenv("api_bili_1")
|