Spaces:
Running
Running
Commit
·
09f5da5
1
Parent(s):
4fe64f3
yaml upd and added jokes
Browse files- .vscode/settings.json +3 -0
- app.py +8 -16
- routes/jokes/__init__.py +1 -0
- routes/jokes/getJoke.py +46 -0
- routes/ytApi/get.py +3 -3
- static/api.yaml +496 -443
.vscode/settings.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"python.analysis.typeCheckingMode": "off"
|
3 |
+
}
|
app.py
CHANGED
@@ -8,7 +8,7 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
8 |
|
9 |
#initing
|
10 |
app = Flask(__name__)
|
11 |
-
VERSION = '1.0
|
12 |
app.config['JSON_AS_ASCII'] = False
|
13 |
|
14 |
#error pages
|
@@ -43,7 +43,7 @@ def favicon(): return send_from_directory(os.path.join(app.root_path, 'static'),
|
|
43 |
#SITE ROUTES
|
44 |
@app.route('/')
|
45 |
def index(): return render_template('index.html')
|
46 |
-
@app.route('/
|
47 |
def systemInfo(): return siteRoutes.systemInfo()
|
48 |
|
49 |
###############
|
@@ -77,12 +77,8 @@ tc_t, tc_m = AutoTokenizer.from_pretrained("EIStakovskii/xlm_roberta_base_multil
|
|
77 |
@app.route('/analyzeText/api/v1/sentiment', methods=['POST'])
|
78 |
def sentimentAnalys():
|
79 |
try:
|
80 |
-
text =
|
81 |
-
if text
|
82 |
-
try: text = request.json.get('text') or ""
|
83 |
-
except: pass
|
84 |
-
|
85 |
-
if text == "": return {"status": "error", "details": { "error_code": 101, "error_details": "No text provided" }}
|
86 |
|
87 |
inputs = sa_t(text, return_tensors="pt")
|
88 |
|
@@ -96,12 +92,8 @@ def sentimentAnalys():
|
|
96 |
@app.route('/analyzeText/api/v1/toxicity', methods=['POST'])
|
97 |
def toxicityAnalys():
|
98 |
try:
|
99 |
-
text =
|
100 |
-
if text
|
101 |
-
try: text = request.json.get('text') or ""
|
102 |
-
except: pass
|
103 |
-
|
104 |
-
if text == "": return {"status": "error", "details": { "error_code": 101, "error_details": "No text provided" }} , 400
|
105 |
|
106 |
inputs = tc_t(text, return_tensors="pt")
|
107 |
|
@@ -115,10 +107,10 @@ def toxicityAnalys():
|
|
115 |
|
116 |
if __name__ == "__main__":
|
117 |
config = configFile()
|
118 |
-
with open(config['config-path'], "w") as outfile:
|
119 |
config['buildVersion'] = VERSION
|
120 |
json.dump(config, outfile)
|
121 |
-
with open(config['openapi-yaml-path'], "r+") as outfile:
|
122 |
info = outfile.read()
|
123 |
outfile.seek(0)
|
124 |
outfile.write(info.replace('$VERSION_VARIABLE$', VERSION))
|
|
|
8 |
|
9 |
#initing
|
10 |
app = Flask(__name__)
|
11 |
+
VERSION = '1.0 build121'
|
12 |
app.config['JSON_AS_ASCII'] = False
|
13 |
|
14 |
#error pages
|
|
|
43 |
#SITE ROUTES
|
44 |
@app.route('/')
|
45 |
def index(): return render_template('index.html')
|
46 |
+
@app.route('/system/api/v1/info', methods=['POST'])
|
47 |
def systemInfo(): return siteRoutes.systemInfo()
|
48 |
|
49 |
###############
|
|
|
77 |
@app.route('/analyzeText/api/v1/sentiment', methods=['POST'])
|
78 |
def sentimentAnalys():
|
79 |
try:
|
80 |
+
text = helpers.getFromRequest(request, "text")
|
81 |
+
if not text: return {"status": "error", "details": { "error_code": 101, "error_details": "No text provided" }}
|
|
|
|
|
|
|
|
|
82 |
|
83 |
inputs = sa_t(text, return_tensors="pt")
|
84 |
|
|
|
92 |
@app.route('/analyzeText/api/v1/toxicity', methods=['POST'])
|
93 |
def toxicityAnalys():
|
94 |
try:
|
95 |
+
text = helpers.getFromRequest(request, "text")
|
96 |
+
if not text: return {"status": "error", "details": { "error_code": 101, "error_details": "No text provided" }} , 400
|
|
|
|
|
|
|
|
|
97 |
|
98 |
inputs = tc_t(text, return_tensors="pt")
|
99 |
|
|
|
107 |
|
108 |
if __name__ == "__main__":
|
109 |
config = configFile()
|
110 |
+
with open(config['config-path'], "w", encoding="utf-8") as outfile:
|
111 |
config['buildVersion'] = VERSION
|
112 |
json.dump(config, outfile)
|
113 |
+
with open(config['openapi-yaml-path'], "r+", encoding="utf-8") as outfile:
|
114 |
info = outfile.read()
|
115 |
outfile.seek(0)
|
116 |
outfile.write(info.replace('$VERSION_VARIABLE$', VERSION))
|
routes/jokes/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .getJoke import *
|
routes/jokes/getJoke.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
from .. import helpers
|
3 |
+
from random import randint
|
4 |
+
from requests import get as reqget
|
5 |
+
from random import choice as randchoice
|
6 |
+
|
7 |
+
def getJoke(request):
|
8 |
+
lang = helpers.getFromRequest(request, "lang")
|
9 |
+
if not lang: return {"status": "error", "details": { "error_code": 133, "error_details": "No lang provided" }}, 400
|
10 |
+
elif lang.lower() not in ['ru']: return {"status": "error", "details": { "error_code": 133, "error_details": "Lang not supported" }}, 400
|
11 |
+
else: lang = lang.lower()
|
12 |
+
|
13 |
+
source = helpers.getFromRequest(request, "source")
|
14 |
+
availableSources = {
|
15 |
+
"ru": ["nekdo", "baneks", "anekdot", "shytok", "anekdotytoday", "4tob", "anepedia"]
|
16 |
+
}
|
17 |
+
if not source or source not in availableSources[lang]: source = randchoice(availableSources[lang])
|
18 |
+
|
19 |
+
try:
|
20 |
+
if source == "nekdo":
|
21 |
+
site = reqget("https://nekdo.ru/random/").text
|
22 |
+
joke = randchoice(re.findall('<div class=\"text\"(.*)</div>', site)).replace('</div>', '').replace('</a>', '').replace('<br>', '\n')
|
23 |
+
joke = re.sub('(<a href="/(\S*)/">| id="(\d*)">)','', joke).strip()
|
24 |
+
elif source == "baneks":
|
25 |
+
site = reqget("https://baneks.ru/random").text
|
26 |
+
joke = site.partition('<p>')[2].partition('</p>')[0].replace('<br />', '').strip()
|
27 |
+
elif source == "anekdot":
|
28 |
+
links = ["https://www.anekdot.ru/random/anekdot/", "https://www.anekdot.ru/random/story/", "https://www.anekdot.ru/random/aphorism/"]
|
29 |
+
site = reqget(randchoice(links)).text
|
30 |
+
joke = site.partition('<div class=\"text\">')[2].partition('</div>')[0].replace('<br>', '\n').strip()
|
31 |
+
elif source == "shytok":
|
32 |
+
site = reqget("https://shytok.net/sluchainye-anekdoty.html").text
|
33 |
+
joke = site.partition('<div class="text2">')[2].partition('<div class="star">')[0].partition('<br>')[2].replace('</div>', '').replace('<br>', '').replace('<br />', '\n').strip()
|
34 |
+
elif source == "anekdotytoday":
|
35 |
+
site = reqget(f"https://anekdotytoday.net/poisk/getanekdot_poisk.php?teg=new&fteg={randint(0,4952)}").text
|
36 |
+
joke = site.partition('<p>')[2].partition('</p>')[0].replace('<br/>', '').strip()
|
37 |
+
elif source == "4tob":
|
38 |
+
site = reqget("https://4tob.ru/anekdots/{}".format(randint(1,3628))).content
|
39 |
+
joke = site.decode().partition('<div class="text">')[2].partition("</div>")[0].replace("<br>", "\n").replace("<br />", "\n").replace("<p>", "").replace("</p>", "").strip()
|
40 |
+
elif source == "anepedia":
|
41 |
+
site = reqget("https://www.anepedia.mobi/%D0%A1%D0%BB%D1%83%D1%87%D0%B0%D0%B9%D0%BD%D1%8B%D0%B9_%D0%B0%D0%BD%D0%B5%D0%BA%D0%B4%D0%BE%D1%82").content.decode()
|
42 |
+
joke = re.sub(r'<a\b[^>]*>', '', site.partition('<div align="left" class="bodytext">')[2].partition("<img src")[0]).replace("</a>", "").replace("<br />", "\n").replace("<br/>", "\n").replace("<br>", "\n").strip()
|
43 |
+
|
44 |
+
return {"status": "pass", "details": {"code": 200, "result": joke}}
|
45 |
+
except Exception as e:
|
46 |
+
return {"status": "error", "details": {"error_code": 500, "error_details": str(e)}}, 500
|
routes/ytApi/get.py
CHANGED
@@ -9,9 +9,9 @@ def get(request, check = "huh"):
|
|
9 |
bitrate = helpers.getFromRequest(request, "bitrate")
|
10 |
if not bitrate: bitrate = "64k"
|
11 |
|
12 |
-
quality = helpers.getFromRequest(request, "quality")
|
13 |
-
if quality.lower() not in ['best', 'worst']: quality = 'worst'
|
14 |
-
else:
|
15 |
|
16 |
urlcode = url.partition('?v=')[2]
|
17 |
if not urlcode: urlcode = "NPRNRQh2fAo"
|
|
|
9 |
bitrate = helpers.getFromRequest(request, "bitrate")
|
10 |
if not bitrate: bitrate = "64k"
|
11 |
|
12 |
+
quality = helpers.getFromRequest(request, "quality")
|
13 |
+
if not quality or quality.lower() not in ['best', 'worst']: quality = 'worst'
|
14 |
+
else: quality = quality.lower()
|
15 |
|
16 |
urlcode = url.partition('?v=')[2]
|
17 |
if not urlcode: urlcode = "NPRNRQh2fAo"
|
static/api.yaml
CHANGED
@@ -1,476 +1,529 @@
|
|
1 |
openapi: 3.0.0
|
2 |
info:
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
servers:
|
7 |
- url: 'https://imperialwool-funapi.hf.space/'
|
8 |
description: 'You are here! ^o^'
|
9 |
paths:
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
schema:
|
19 |
-
type: 'string'
|
20 |
-
example: rickroll
|
21 |
-
summary: "Generating auth key with small TTL."
|
22 |
-
responses:
|
23 |
-
200:
|
24 |
-
description: OK
|
25 |
-
content:
|
26 |
-
application/json:
|
27 |
schema:
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
schema:
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
schema:
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
schema:
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
schema:
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
schema:
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
parameters:
|
96 |
-
- name: 'query'
|
97 |
-
description: Query to find beatmap and download full song.
|
98 |
-
in: 'query'
|
99 |
-
schema:
|
100 |
-
type: 'string'
|
101 |
-
example: rickroll
|
102 |
-
- name: 'beatmapId'
|
103 |
-
description: Beatset id. Not map, set.
|
104 |
-
in: 'query'
|
105 |
-
schema:
|
106 |
-
type: 'integer'
|
107 |
-
example: 1
|
108 |
-
summary: "Get beatmap's song preview."
|
109 |
-
responses:
|
110 |
-
200:
|
111 |
-
description: OK
|
112 |
-
content:
|
113 |
-
application/json:
|
114 |
schema:
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
schema:
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
summary: "Information about server."
|
127 |
-
responses:
|
128 |
-
200:
|
129 |
-
description: OK
|
130 |
-
content:
|
131 |
-
application/json:
|
132 |
schema:
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
schema:
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
schema:
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
application/json:
|
164 |
schema:
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
parameters:
|
171 |
-
- name: 'url'
|
172 |
-
description: Url to video from YouTube. (TikTok also works sometimes.)
|
173 |
-
in: 'query'
|
174 |
-
schema:
|
175 |
-
type: 'string'
|
176 |
-
- name: 'bitrate'
|
177 |
-
description: Bitrate of final audio.
|
178 |
-
in: 'query'
|
179 |
-
schema:
|
180 |
-
type: 'string'
|
181 |
-
example: "64k"
|
182 |
-
- name: 'quality'
|
183 |
-
description: Quality of final audio. Only 'worst' or 'best'.
|
184 |
-
in: 'query'
|
185 |
-
schema:
|
186 |
-
type: 'string'
|
187 |
-
example: "worst"
|
188 |
-
|
189 |
-
summary: "Download video as audio and providing link for you."
|
190 |
-
responses:
|
191 |
-
200:
|
192 |
-
description: OK
|
193 |
-
content:
|
194 |
-
application/json:
|
195 |
schema:
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
schema:
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
- "Youtube: Becoming Music Platform"
|
207 |
-
parameters:
|
208 |
-
- name: 'url'
|
209 |
-
description: Url to video from YouTube. (TikTok also works sometimes.)
|
210 |
-
in: 'query'
|
211 |
-
schema:
|
212 |
-
type: 'string'
|
213 |
-
- name: 'bitrate'
|
214 |
-
description: Bitrate of final audio.
|
215 |
-
in: 'query'
|
216 |
-
schema:
|
217 |
-
type: 'string'
|
218 |
-
example: "64k"
|
219 |
-
- name: 'quality'
|
220 |
-
description: Quality of final audio. Only 'worst' or 'best'.
|
221 |
-
in: 'query'
|
222 |
-
schema:
|
223 |
-
type: 'string'
|
224 |
-
example: "worst"
|
225 |
-
- name: 'duration'
|
226 |
-
description: Duration of preview. Maximum 60 seconds.
|
227 |
-
in: 'query'
|
228 |
-
schema:
|
229 |
-
type: 'integer'
|
230 |
-
example: 30
|
231 |
-
summary: "Download video as cutted audio and providing link for you."
|
232 |
-
responses:
|
233 |
-
200:
|
234 |
-
description: OK
|
235 |
-
content:
|
236 |
-
application/json:
|
237 |
schema:
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
schema:
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
components:
|
246 |
schemas:
|
247 |
SongFullObject:
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
SongPreviewObject:
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
BeatmapObject:
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
FindBeatmapsObject:
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
SysinfoObject:
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
AuthSuccessObject:
|
370 |
-
type: object
|
371 |
-
properties:
|
372 |
-
status:
|
373 |
-
type: string
|
374 |
-
example: pass
|
375 |
-
endtime:
|
376 |
-
type: integer
|
377 |
-
example: 1672602259
|
378 |
-
result:
|
379 |
-
type: string
|
380 |
-
example: B46AAB1A3F1E33625C1B6BD9507453B928DE69BA638E7098DB533A2184ED288EFB899D563EF8AB5487DACBCAD909A801E4C81FD6D34B639F6591295CD1D10A5B
|
381 |
-
AuthErrorObject:
|
382 |
-
type: object
|
383 |
-
properties:
|
384 |
-
status:
|
385 |
-
type: string
|
386 |
-
example: error
|
387 |
-
details:
|
388 |
-
type: object
|
389 |
-
properties:
|
390 |
-
error_code:
|
391 |
-
type: integer
|
392 |
-
example: -1
|
393 |
-
error_details:
|
394 |
-
type: string
|
395 |
-
example: This key already got signature
|
396 |
ErrorObject:
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
RecognizeObject:
|
412 |
-
type: object
|
413 |
-
properties:
|
414 |
-
status:
|
415 |
-
type: string
|
416 |
-
example: pass
|
417 |
-
result:
|
418 |
-
type: string
|
419 |
-
example: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean condimentum neque quis enim bibendum, ut molestie magna gravida. Donec et felis eget lacus sodales convallis. Quisque vitae erat et leo lobortis iaculis. Maecenas a lectus vitae metus fringilla luctus. Morbi sed pellentesque elit. Phasellus bibendum et urna sed elementum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus."
|
420 |
YTSearchObject:
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
YTFullObject:
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
YTPreviewResult:
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
|
|
1 |
openapi: 3.0.0
|
2 |
info:
|
3 |
+
title: imperialwool's FunAPI
|
4 |
+
description: Big API for bots, developers or just fun by @podvaljoey (telegram).
|
5 |
+
version: $VERSION_VARIABLE$
|
6 |
servers:
|
7 |
- url: 'https://imperialwool-funapi.hf.space/'
|
8 |
description: 'You are here! ^o^'
|
9 |
paths:
|
10 |
+
/analyzeText/api/v1/toxicity:
|
11 |
+
post:
|
12 |
+
tags:
|
13 |
+
- "Analyze text API"
|
14 |
+
parameters:
|
15 |
+
- name: 'text'
|
16 |
+
description: Text to analyze
|
17 |
+
in: 'lang'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
schema:
|
19 |
+
type: 'string'
|
20 |
+
example: ru
|
21 |
+
summary: "Classifying a text as toxic or not toxic"
|
22 |
+
responses:
|
23 |
+
200:
|
24 |
+
description: OK
|
25 |
+
content:
|
26 |
+
application/json:
|
27 |
+
schema:
|
28 |
+
$ref: "#/components/schemas/PredictedToxicityObject"
|
29 |
+
400:
|
30 |
+
description: Bad Request
|
31 |
+
content:
|
32 |
+
application/json:
|
33 |
+
schema:
|
34 |
+
$ref: "#/components/schemas/ErrorObject"
|
35 |
+
/analyzeText/api/v1/sentiment:
|
36 |
+
post:
|
37 |
+
tags:
|
38 |
+
- "Analyze text API"
|
39 |
+
parameters:
|
40 |
+
- name: 'text'
|
41 |
+
description: Text to analyze
|
42 |
+
in: 'lang'
|
43 |
schema:
|
44 |
+
type: 'string'
|
45 |
+
example: ru
|
46 |
+
summary: "Classifying a text as negative, positive or neutral"
|
47 |
+
responses:
|
48 |
+
200:
|
49 |
+
description: OK
|
50 |
+
content:
|
51 |
+
application/json:
|
52 |
+
schema:
|
53 |
+
$ref: "#/components/schemas/PredictedSentimentObject"
|
54 |
+
400:
|
55 |
+
description: Bad Request
|
56 |
+
content:
|
57 |
+
application/json:
|
58 |
+
schema:
|
59 |
+
$ref: "#/components/schemas/ErrorObject"
|
60 |
+
/jokes/api/v1/get:
|
61 |
+
post:
|
62 |
+
tags:
|
63 |
+
- "Jokes API"
|
64 |
+
parameters:
|
65 |
+
- name: 'lang'
|
66 |
+
description: Language in which to look for a joke. (Now supported only ru, sorry.)
|
67 |
+
in: 'lang'
|
68 |
schema:
|
69 |
+
type: 'string'
|
70 |
+
example: ru
|
71 |
+
- name: 'source'
|
72 |
+
description: You can get sources and use one of them, if you like.
|
73 |
+
in: 'source'
|
74 |
schema:
|
75 |
+
type: 'string'
|
76 |
+
example: chucknorris
|
77 |
+
summary: "Finding joke by language."
|
78 |
+
responses:
|
79 |
+
200:
|
80 |
+
description: OK
|
81 |
+
content:
|
82 |
+
application/json:
|
83 |
+
schema:
|
84 |
+
$ref: "#/components/schemas/JokeObject"
|
85 |
+
400:
|
86 |
+
description: Bad Request
|
87 |
+
content:
|
88 |
+
application/json:
|
89 |
+
schema:
|
90 |
+
$ref: "#/components/schemas/ErrorObject"
|
91 |
+
/osu/api/v1/find-song:
|
92 |
+
post:
|
93 |
+
tags:
|
94 |
+
- "osu! API"
|
95 |
+
parameters:
|
96 |
+
- name: 'query'
|
97 |
+
description: Query to find beatmap.
|
98 |
+
in: 'query'
|
99 |
schema:
|
100 |
+
type: 'string'
|
101 |
+
example: rickroll
|
102 |
+
summary: "Finding beatmap by query."
|
103 |
+
responses:
|
104 |
+
200:
|
105 |
+
description: OK
|
106 |
+
content:
|
107 |
+
application/json:
|
108 |
+
schema:
|
109 |
+
$ref: "#/components/schemas/FindBeatmapsObject"
|
110 |
+
400:
|
111 |
+
description: Bad Request
|
112 |
+
content:
|
113 |
+
application/json:
|
114 |
+
schema:
|
115 |
+
$ref: "#/components/schemas/ErrorObject"
|
116 |
+
/osu/api/v1/get-full:
|
117 |
+
post:
|
118 |
+
tags:
|
119 |
+
- "osu! API"
|
120 |
+
parameters:
|
121 |
+
- name: 'query'
|
122 |
+
description: Query to find beatmap and download full song.
|
123 |
+
in: 'query'
|
124 |
schema:
|
125 |
+
type: 'string'
|
126 |
+
example: rickroll
|
127 |
+
- name: 'beatmapId'
|
128 |
+
description: Beatset id. Not map, set.
|
129 |
+
in: 'query'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
schema:
|
131 |
+
type: 'integer'
|
132 |
+
example: 1
|
133 |
+
summary: "Get beatmap's full song."
|
134 |
+
responses:
|
135 |
+
200:
|
136 |
+
description: OK
|
137 |
+
content:
|
138 |
+
application/json:
|
139 |
+
schema:
|
140 |
+
$ref: "#/components/schemas/SongFullObject"
|
141 |
+
400:
|
142 |
+
description: Bad Request
|
143 |
+
content:
|
144 |
+
application/json:
|
145 |
+
schema:
|
146 |
+
$ref: "#/components/schemas/ErrorObject"
|
147 |
+
/osu/api/v1/get-preview:
|
148 |
+
post:
|
149 |
+
tags:
|
150 |
+
- "osu! API"
|
151 |
+
parameters:
|
152 |
+
- name: 'query'
|
153 |
+
description: Query to find beatmap and download full song.
|
154 |
+
in: 'query'
|
155 |
schema:
|
156 |
+
type: 'string'
|
157 |
+
example: rickroll
|
158 |
+
- name: 'beatmapId'
|
159 |
+
description: Beatset id. Not map, set.
|
160 |
+
in: 'query'
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
schema:
|
162 |
+
type: 'integer'
|
163 |
+
example: 1
|
164 |
+
summary: "Get beatmap's song preview."
|
165 |
+
responses:
|
166 |
+
200:
|
167 |
+
description: OK
|
168 |
+
content:
|
169 |
+
application/json:
|
170 |
+
schema:
|
171 |
+
$ref: "#/components/schemas/SongPreviewObject"
|
172 |
+
400:
|
173 |
+
description: Bad Request
|
174 |
+
content:
|
175 |
+
application/json:
|
176 |
+
schema:
|
177 |
+
$ref: "#/components/schemas/ErrorObject"
|
178 |
+
/system/api/v1/info:
|
179 |
+
post:
|
180 |
+
tags:
|
181 |
+
- "System information"
|
182 |
+
summary: "Information about server."
|
183 |
+
responses:
|
184 |
+
200:
|
185 |
+
description: OK
|
186 |
+
content:
|
187 |
+
application/json:
|
188 |
+
schema:
|
189 |
+
$ref: "#/components/schemas/SysinfoObject"
|
190 |
+
400:
|
191 |
+
description: Bad Request
|
192 |
+
content:
|
193 |
+
application/json:
|
194 |
+
schema:
|
195 |
+
$ref: "#/components/schemas/ErrorObject"
|
196 |
+
/yt/api/v1/search:
|
197 |
+
post:
|
198 |
+
tags:
|
199 |
+
- "Youtube: Becoming Music Platform"
|
200 |
+
parameters:
|
201 |
+
- name: 'query'
|
202 |
+
description: Query for YouTube to find videos.
|
203 |
+
in: 'query'
|
204 |
schema:
|
205 |
+
type: 'string'
|
206 |
+
example: never gonna give you up
|
207 |
+
|
208 |
+
summary: "This method can help with searching videos on YouTube."
|
209 |
+
responses:
|
210 |
+
200:
|
211 |
+
description: OK
|
212 |
+
content:
|
213 |
+
application/json:
|
214 |
+
schema:
|
215 |
+
$ref: "#/components/schemas/YTSearchObject"
|
216 |
+
400:
|
217 |
+
description: Bad Request
|
218 |
+
content:
|
219 |
+
application/json:
|
220 |
+
schema:
|
221 |
+
$ref: "#/components/schemas/ErrorObject"
|
222 |
+
/yt/api/v1/get-full:
|
223 |
+
post:
|
224 |
+
tags:
|
225 |
+
- "Youtube: Becoming Music Platform"
|
226 |
+
parameters:
|
227 |
+
- name: 'url'
|
228 |
+
description: Url to video from YouTube. (TikTok also works sometimes.)
|
229 |
+
in: 'query'
|
230 |
schema:
|
231 |
+
type: 'string'
|
232 |
+
- name: 'bitrate'
|
233 |
+
description: Bitrate of final audio.
|
234 |
+
in: 'query'
|
|
|
235 |
schema:
|
236 |
+
type: 'string'
|
237 |
+
example: "64k"
|
238 |
+
- name: 'quality'
|
239 |
+
description: Quality of final audio. Only 'worst' or 'best'.
|
240 |
+
in: 'query'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
schema:
|
242 |
+
type: 'string'
|
243 |
+
example: "worst"
|
244 |
+
|
245 |
+
summary: "Download video as audio and providing link for you."
|
246 |
+
responses:
|
247 |
+
200:
|
248 |
+
description: OK
|
249 |
+
content:
|
250 |
+
application/json:
|
251 |
+
schema:
|
252 |
+
$ref: "#/components/schemas/YTFullObject"
|
253 |
+
400:
|
254 |
+
description: Bad Request
|
255 |
+
content:
|
256 |
+
application/json:
|
257 |
+
schema:
|
258 |
+
$ref: "#/components/schemas/ErrorObject"
|
259 |
+
/yt/api/v1/get-preview:
|
260 |
+
post:
|
261 |
+
tags:
|
262 |
+
- "Youtube: Becoming Music Platform"
|
263 |
+
parameters:
|
264 |
+
- name: 'url'
|
265 |
+
description: Url to video from YouTube. (TikTok also works sometimes.)
|
266 |
+
in: 'query'
|
267 |
schema:
|
268 |
+
type: 'string'
|
269 |
+
- name: 'bitrate'
|
270 |
+
description: Bitrate of final audio.
|
271 |
+
in: 'query'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
schema:
|
273 |
+
type: 'string'
|
274 |
+
example: "64k"
|
275 |
+
- name: 'quality'
|
276 |
+
description: Quality of final audio. Only 'worst' or 'best'.
|
277 |
+
in: 'query'
|
278 |
schema:
|
279 |
+
type: 'string'
|
280 |
+
example: "worst"
|
281 |
+
- name: 'duration'
|
282 |
+
description: Duration of preview. Maximum 60 seconds.
|
283 |
+
in: 'query'
|
284 |
+
schema:
|
285 |
+
type: 'integer'
|
286 |
+
example: 45
|
287 |
+
summary: "Download video as cutted audio and providing link for you."
|
288 |
+
responses:
|
289 |
+
200:
|
290 |
+
description: OK
|
291 |
+
content:
|
292 |
+
application/json:
|
293 |
+
schema:
|
294 |
+
$ref: "#/components/schemas/YTPreviewResult"
|
295 |
+
400:
|
296 |
+
description: Bad Request
|
297 |
+
content:
|
298 |
+
application/json:
|
299 |
+
schema:
|
300 |
+
$ref: "#/components/schemas/ErrorObject"
|
301 |
components:
|
302 |
schemas:
|
303 |
SongFullObject:
|
304 |
+
type: object
|
305 |
+
properties:
|
306 |
+
status:
|
307 |
+
type: string
|
308 |
+
example: pass
|
309 |
+
details:
|
310 |
+
type: object
|
311 |
+
properties:
|
312 |
+
code:
|
313 |
+
type: integer
|
314 |
+
example: 200
|
315 |
+
name:
|
316 |
+
type: string
|
317 |
+
example: "1592415.ogg"
|
318 |
+
result:
|
319 |
+
type: string
|
320 |
+
example: "https://imperialwool-funapi.hf.space/static/full/1592415.ogg"
|
321 |
SongPreviewObject:
|
322 |
+
type: object
|
323 |
+
properties:
|
324 |
+
status:
|
325 |
+
type: string
|
326 |
+
example: pass
|
327 |
+
details:
|
328 |
+
type: object
|
329 |
+
properties:
|
330 |
+
code:
|
331 |
+
type: integer
|
332 |
+
example: 200
|
333 |
+
name:
|
334 |
+
type: string
|
335 |
+
example: "1244874.mp3"
|
336 |
+
result:
|
337 |
+
type: string
|
338 |
+
example: "https://b.ppy.sh/preview/1244874.mp3"
|
339 |
BeatmapObject:
|
340 |
+
type: object
|
341 |
+
properties:
|
342 |
+
"artist":
|
343 |
+
type: string
|
344 |
+
example: "never gonna give you up remix"
|
345 |
+
"beatmapId":
|
346 |
+
type: integer
|
347 |
+
example: 1542795
|
348 |
+
"creator":
|
349 |
+
type: string
|
350 |
+
example: "CrisFloppa"
|
351 |
+
"source":
|
352 |
+
type: string
|
353 |
+
example: ""
|
354 |
+
"tags":
|
355 |
+
type: string
|
356 |
+
example: "never gonna gie you up rick roll"
|
357 |
+
"title":
|
358 |
+
type: string
|
359 |
+
example: "rick astley"
|
360 |
+
PredictedSentimentObject:
|
361 |
+
type: object
|
362 |
+
properties:
|
363 |
+
status:
|
364 |
+
type: string
|
365 |
+
example: pass
|
366 |
+
predicted_sentiment:
|
367 |
+
type: string
|
368 |
+
example: Positive
|
369 |
+
PredictedToxicityObject:
|
370 |
+
type: object
|
371 |
+
properties:
|
372 |
+
status:
|
373 |
+
type: string
|
374 |
+
example: pass
|
375 |
+
toxicity:
|
376 |
+
type: bool
|
377 |
+
example: False
|
378 |
FindBeatmapsObject:
|
379 |
+
type: object
|
380 |
+
properties:
|
381 |
+
status:
|
382 |
+
type: string
|
383 |
+
example: pass
|
384 |
+
details:
|
385 |
+
type: object
|
386 |
+
properties:
|
387 |
+
"code":
|
388 |
+
type: integer
|
389 |
+
example: 200
|
390 |
+
"result":
|
391 |
+
type: array
|
392 |
+
items:
|
393 |
+
$ref: "#/components/schemas/BeatmapObject"
|
394 |
+
JokeObject:
|
395 |
+
type: object
|
396 |
+
properties:
|
397 |
+
status:
|
398 |
+
type: string
|
399 |
+
example: pass
|
400 |
+
details:
|
401 |
+
type: object
|
402 |
+
properties:
|
403 |
+
"code":
|
404 |
+
type: integer
|
405 |
+
example: 200
|
406 |
+
"result":
|
407 |
+
type: string
|
408 |
+
example: ".NET developers are picky when it comes to food.\nThey only like chicken NuGet."
|
409 |
SysinfoObject:
|
410 |
+
type: object
|
411 |
+
properties:
|
412 |
+
"API_VERSION":
|
413 |
+
type: string
|
414 |
+
example: "$VERSION_VARIABLE$"
|
415 |
+
"CPU_INFO":
|
416 |
+
type: object
|
417 |
+
properties:
|
418 |
+
"cpu_brand":
|
419 |
+
type: string
|
420 |
+
example: "AMD EPYC 7R13 Processor"
|
421 |
+
"cpu_count":
|
422 |
+
type: object
|
423 |
+
properties:
|
424 |
+
"all":
|
425 |
+
type: integer
|
426 |
+
example: 16
|
427 |
+
"exclude_virtual":
|
428 |
+
type: integer
|
429 |
+
example: 8
|
430 |
+
"cpu_freq":
|
431 |
+
type: object
|
432 |
+
properties:
|
433 |
+
"current":
|
434 |
+
type: number
|
435 |
+
format: float
|
436 |
+
example: 3522.9323125
|
437 |
+
"min":
|
438 |
+
type: number
|
439 |
+
format: float
|
440 |
+
example: 0.0
|
441 |
+
"max":
|
442 |
+
type: number
|
443 |
+
format: float
|
444 |
+
example: 3600.0
|
445 |
+
"cpu_load":
|
446 |
+
type: number
|
447 |
+
format: float
|
448 |
+
example: 16.2
|
449 |
+
"MEM_INFO":
|
450 |
+
type: object
|
451 |
+
properties:
|
452 |
+
"mem_total":
|
453 |
+
type: integer
|
454 |
+
example: 126125
|
455 |
+
"mem_used":
|
456 |
+
type: integer
|
457 |
+
example: 87497
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
ErrorObject:
|
459 |
+
type: object
|
460 |
+
properties:
|
461 |
+
status:
|
462 |
+
type: string
|
463 |
+
example: error
|
464 |
+
details:
|
465 |
+
type: object
|
466 |
+
properties:
|
467 |
+
error_code:
|
468 |
+
type: integer
|
469 |
+
example: 1337
|
470 |
+
error_details:
|
471 |
+
type: string
|
472 |
+
example: Some error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
YTSearchObject:
|
474 |
+
type: object
|
475 |
+
properties:
|
476 |
+
status:
|
477 |
+
type: string
|
478 |
+
example: ok
|
479 |
+
query:
|
480 |
+
type: string
|
481 |
+
example: never gonna give you up
|
482 |
+
videoIds:
|
483 |
+
type: object
|
484 |
+
properties:
|
485 |
+
"0":
|
486 |
+
type: string
|
487 |
+
example: dQw4w9WgXcQ
|
488 |
+
"1":
|
489 |
+
type: string
|
490 |
+
example: GtL1huin9EE
|
491 |
+
"2":
|
492 |
+
type: string
|
493 |
+
example: uXV-IaR_vNE
|
494 |
YTFullObject:
|
495 |
+
type: object
|
496 |
+
properties:
|
497 |
+
status:
|
498 |
+
type: string
|
499 |
+
example: pass
|
500 |
+
details:
|
501 |
+
type: object
|
502 |
+
properties:
|
503 |
+
code:
|
504 |
+
type: integer
|
505 |
+
example: 0
|
506 |
+
name:
|
507 |
+
type: string
|
508 |
+
example: "R8YprjS6ztg.ogg"
|
509 |
+
result:
|
510 |
+
type: string
|
511 |
+
example: "https://imperialwool-funapi.hf.space/static/full/R8YprjS6ztg.ogg"
|
512 |
YTPreviewResult:
|
513 |
+
type: object
|
514 |
+
properties:
|
515 |
+
status:
|
516 |
+
type: string
|
517 |
+
example: pass
|
518 |
+
details:
|
519 |
+
type: object
|
520 |
+
properties:
|
521 |
+
code:
|
522 |
+
type: integer
|
523 |
+
example: 0
|
524 |
+
name:
|
525 |
+
type: string
|
526 |
+
example: "R8YprjS6ztg.ogg"
|
527 |
+
result:
|
528 |
+
type: string
|
529 |
+
example: "https://imperialwool-funapi.hf.space/static/previews/R8YprjS6ztg.ogg"
|