Ufoptg commited on
Commit
1f5c55e
β€’
1 Parent(s): ef24efb

Upload 19 files

Browse files
Files changed (5) hide show
  1. Dockerfile +1 -1
  2. README.md +4 -6
  3. functions.py +1 -1
  4. main.py +380 -877
  5. requirements.txt +2 -3
Dockerfile CHANGED
@@ -18,4 +18,4 @@ COPY . .
18
  RUN pip3 install --upgrade pip setuptools
19
  RUN pip3 install -r requirements.txt
20
 
21
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
18
  RUN pip3 install --upgrade pip setuptools
19
  RUN pip3 install -r requirements.txt
20
 
21
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,10 +1,8 @@
1
  ---
2
- title: Ryuzaki Api
3
  emoji: πŸ“ˆ
4
- colorFrom: pink
5
- colorTo: purple
6
  sdk: docker
7
  pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: UFoP Api
3
  emoji: πŸ“ˆ
4
+ colorFrom: red
5
+ colorTo: blue
6
  sdk: docker
7
  pinned: false
8
+ ---
 
 
functions.py CHANGED
@@ -29,4 +29,4 @@ def ryuzaki_ai_text(text):
29
  API_URL = SOURCE_ALPHA_URL
30
  headers = {"Authorization": f"Bearer {HUGGING_TOKEN}"}
31
  response = requests.post(API_URL, headers=headers, json={"inputs": text})
32
- return response.json()
 
29
  API_URL = SOURCE_ALPHA_URL
30
  headers = {"Authorization": f"Bearer {HUGGING_TOKEN}"}
31
  response = requests.post(API_URL, headers=headers, json={"inputs": text})
32
+ return response.json()
main.py CHANGED
@@ -25,19 +25,17 @@ import uvicorn
25
  import os
26
  import shutil
27
  import random
 
28
  import tempfile
29
  import io
30
- import openai
31
  from io import BytesIO
32
  from datetime import datetime as dt
33
  from dotenv import load_dotenv
34
  from bs4 import BeautifulSoup
35
 
36
- from typing import *
37
  from typing_extensions import Annotated
38
  from typing import Annotated, Union
39
- from typing import Optional, List, Dict, Any
40
-
41
 
42
  from pydantic import BaseModel
43
  from base64 import b64decode as kc
@@ -49,10 +47,9 @@ from telegraph import Telegraph, upload_file
49
  from pathlib import Path
50
  from serpapi import GoogleSearch
51
 
52
- from fastapi import FastAPI, UploadFile, File, Response
53
  from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
54
  from fastapi import Depends, FastAPI, HTTPException, status
55
- from fastapi.openapi.utils import get_openapi
56
  from fastapi.responses import StreamingResponse
57
  from fastapi import HTTPException
58
  from fastapi import FastAPI, Request, Header
@@ -61,70 +58,50 @@ from fastapi.staticfiles import StaticFiles
61
  from fastapi.templating import Jinja2Templates
62
  from fastapi.responses import FileResponse
63
 
64
- from pymongo import MongoClient
65
-
66
  from RyuzakiLib.hackertools.chatgpt import RendyDevChat
67
  from RyuzakiLib.hackertools.openai_api import OpenAiToken
68
  from RyuzakiLib.mental import BadWordsList
69
- from RyuzakiLib.system import OpenReadSystem
70
-
71
- from bardapi import Bard
72
-
73
- from models import *
74
-
75
- from gpytranslate import SyncTranslator
76
 
77
  import logging
 
78
  import functions as code
79
 
80
  logging.basicConfig(level=logging.ERROR)
81
 
82
-
83
  load_dotenv()
84
-
85
- # Database url
86
- MONGO_URL = os.environ["MONGO_URL"]
87
-
88
- # source url
89
  SOURCE_UNSPLASH_URL = os.environ["SOURCE_UNSPLASH_URL"]
90
  SOURCE_OCR_URL = os.environ["SOURCE_OCR_URL"]
91
  SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
92
- SOURCE_OPENDALLE_URL = os.environ["SOURCE_OPENDALLE_URL"]
93
- SOURCE_ANIME_STYLED_URL = os.environ["SOURCE_ANIME_STYLED_URL"]
94
- SOURCE_WAIFU_URL = os.environ["SOURCE_WAIFU_URL"]
95
  SOURCE_TIKTOK_WTF_URL = os.environ["SOURCE_TIKTOK_WTF_URL"]
96
  SOURCE_TIKTOK_TECH_URL = os.environ["SOURCE_TIKTOK_TECH_URL"]
97
- SOURCE_WHAT_GAY_URL = os.environ["SOURCE_WHAT_GAY_URL"]
98
- SOURCE_ASSISTANT_GOOGLE_AI = os.environ["SOURCE_ASSISTANT_GOOGLE_AI"]
99
- SOURCE_OPENAI_ACCESS_URL = os.environ["SOURCE_OPENAI_ACCESS_URL"]
100
 
101
- # api keys
102
- REVERSE_IMAGE_API = os.environ["REVERSE_IMAGE_API"]
103
- OCR_API_KEY = os.environ["OCR_API_KEY"]
104
- ONLY_DEVELOPER_API_KEYS = os.environ["ONLY_DEVELOPER_API_KEYS"]
105
- HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
106
- ASSISTANT_GOOGLE_API_KEYS = os.environ["ASSISTANT_GOOGLE_API_KEYS"]
107
- #COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
108
-
109
- client_mongo = MongoClient(MONGO_URL)
110
- db = client_mongo["tiktokbot"]
111
- collection = db["users"]
112
-
113
- trans = SyncTranslator()
114
-
115
- app = FastAPI(docs_url=None, redoc_url="/")
116
 
117
- def get_all_api_keys():
118
- user = collection.find({})
119
- api_keys = []
120
- for x in user:
121
- api_key = x.get("ryuzaki_api_key")
122
- if api_key:
123
- api_keys.append(api_key)
124
- return api_keys
 
 
 
125
 
126
  def validate_api_key(api_key: str = Header(...)):
127
- USERS_API_KEYS = get_all_api_keys()
128
  if api_key not in USERS_API_KEYS:
129
  raise HTTPException(status_code=401, detail="Invalid API key")
130
 
@@ -132,151 +109,10 @@ def validate_api_key_only_devs(api_key: str = Header(...)):
132
  if api_key not in ONLY_DEVELOPER_API_KEYS:
133
  raise HTTPException(status_code=401, detail="Invalid API key")
134
 
135
- RAMDOM_STATUS = [
136
- "civilian",
137
- "wanted",
138
- "undercover",
139
- "rogue_agent",
140
- "innocent",
141
- "fugitive",
142
- "covert_operator"
143
- ]
144
-
145
- def remove_sibyl_system_banned(user_id):
146
- update_doc = {
147
- "sibyl_ban": None,
148
- "reason_sibyl": None,
149
- "is_banned_sibly": None,
150
- "date_joined_sib": None,
151
- "sibyl_userid": None
152
- }
153
- return collection.update_one({"user_id": user_id}, {"$unset": update_doc}, upsert=True)
154
-
155
- def new_sibyl_system_banned(user_id, name, reason, date_joined):
156
- update_doc = {
157
- "sibyl_ban": name,
158
- "reason_sibyl": reason,
159
- "is_banned_sibly": True,
160
- "date_joined_sib": date_joined,
161
- "sibyl_userid": user_id
162
- }
163
- return collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
164
-
165
- def get_sibyl_system_banned(user_id):
166
- user = collection.find_one({"user_id": user_id})
167
- if user:
168
- sibyl_name = user.get("sibyl_ban")
169
- reason = user.get("reason_sibyl")
170
- is_banned = user.get("is_banned_sibly")
171
- date_joined = user.get("date_joined_sib")
172
- sibyl_user_id = user.get("sibyl_userid")
173
- return sibyl_name, reason, is_banned, date_joined, sibyl_user_id
174
- else:
175
- return None
176
-
177
- def get_all_banned():
178
- banned_users = []
179
-
180
- users = collection.find({})
181
-
182
- for user_id in users:
183
- reason = user_id.get("reason_sibyl")
184
- user_id = user_id.get("sibyl_userid")
185
- banned_users.append({"user_id": user_id, "reason": reason})
186
- return banned_users
187
-
188
- def new_profile_clone(
189
- user_id,
190
- first_name,
191
- last_name=None,
192
- profile_id=None,
193
- bio=None
194
- ):
195
- update_doc = {
196
- "first_name_2": first_name,
197
- "last_name_2": last_name,
198
- "profile_id_2": profile_id,
199
- "bio_2": bio
200
- }
201
- collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
202
-
203
- def get_profile_clone(user_id):
204
- user = collection.find_one({"user_id": user_id})
205
- if user:
206
- first_name = user.get("first_name_2")
207
- last_name = user.get("last_name_2")
208
- profile_id = user.get("profile_id_2")
209
- bio = user.get("bio_2")
210
- return first_name, last_name, profile_id, bio
211
- else:
212
- return None
213
-
214
- @app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
215
- def profile_clone(
216
- item: ProfileClone,
217
- api_key: None = Depends(validate_api_key)
218
- ):
219
- if item.user_id == 1191668125:
220
- return {"status": "false", "message": "Only Developer"}
221
-
222
- try:
223
- new_profile_clone(
224
- user_id=item.user_id,
225
- first_name=item.first_name,
226
- last_name=item.last_name,
227
- profile_id=item.profile_id,
228
- bio=item.bio
229
- )
230
- return SuccessResponse(
231
- status="True",
232
- randydev={
233
- "user_id": item.user_id,
234
- "first_name": item.first_name,
235
- "last_name": item.last_name,
236
- "profile_id": item.profile_id,
237
- "bio": item.bio
238
- }
239
- )
240
- except Exception as e:
241
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
242
-
243
- @app.get("/ryuzaki/get-profile-clone", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
244
- def get_profile_(
245
- item: GetProfileClone,
246
- api_key: None = Depends(validate_api_key)
247
- ):
248
- try:
249
- first_name, last_name, profile_id, bio = get_profile_clone(item.user_id)
250
- if last_name is None:
251
- last_name_str = ""
252
- else:
253
- last_name_str = last_name
254
- if bio is None:
255
- bio_str = ""
256
- else:
257
- bio_str = bio
258
- if first_name and profile_id:
259
- return SuccessResponse(
260
- status="True",
261
- randydev={
262
- "user_id": item.user_id,
263
- "first_name": first_name,
264
- "last_name": last_name_str,
265
- "profile_id": profile_id,
266
- "bio": bio_str
267
- }
268
- )
269
- else:
270
- return SuccessResponse(
271
- status="False",
272
- randydev={"message": "Not found user"}
273
- )
274
- except Exception as e:
275
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
276
 
277
  @app.get("/UFoP/getbanlist")
278
  def sibyl_get_all_banlist():
279
- banned_users = get_all_banned()
280
  return {
281
  "status": "True",
282
  "randydev": {
@@ -284,7 +120,7 @@ def sibyl_get_all_banlist():
284
  }
285
  }
286
 
287
- @app.get("/ryuzaki/blacklist-words")
288
  def blacklist_words():
289
  try:
290
  BLACKLIST_WORDS = BadWordsList()
@@ -293,130 +129,128 @@ def blacklist_words():
293
  except Exception as e:
294
  return {"status": "false", "message": f"Internal server error: {str(e)}"}
295
 
296
- @app.delete("/UFoP/sibyldel", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
297
  def sibyl_system_delete(
298
- item: SibylSystemDel,
299
  api_key: None = Depends(validate_api_key_only_devs)
300
  ):
301
  try:
302
- _, _, _, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
303
 
304
  if sibyl_user_id:
305
- remove_sibyl_system_banned(item.user_id)
306
- return SuccessResponse(
307
- status="True",
308
- randydev={"message": f"Successfully removed {item.user_id} from the Sibyl ban list"}
309
- )
310
  else:
311
- return SuccessResponse(
312
- status="False",
313
- randydev={"message": "Not Found UserID"}
314
- )
315
  except Exception as e:
316
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
317
 
318
- @app.post("/UFoP/sibylban", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
319
  def sibyl_system_ban(
320
- item: SibylSystemBan,
 
321
  api_key: None = Depends(validate_api_key_only_devs)
322
  ):
323
- if item.user_id == 1191668125:
324
  return {"status": "false", "message": "Only Developer"}
325
 
326
  try:
327
  date_joined = str(dt.now())
328
- sibyl_ban = random.choice(RAMDOM_STATUS)
329
- _, _, is_banned, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
330
-
331
- if sibyl_user_id and is_banned:
 
332
  return {"status": "false", "message": "User is already banned"}
333
 
334
- new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
335
- return SuccessResponse(
336
- status="True",
337
- randydev={
338
- "user_id": item.user_id,
 
339
  "sibyl_name": sibyl_ban,
340
- "reason": item.reason,
341
  "date_joined": date_joined,
342
- "message": f"Successfully banned {item.user_id} from the Sibyl ban list."
343
  }
344
- )
345
  except Exception as e:
346
- return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
 
347
 
348
- @app.get("/UFoP/sibyl", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
349
  def sibyl_system(
350
- item: SibylSystem,
351
- api_key: None = Depends(validate_api_key)
352
  ):
353
- sibyl_result = get_sibyl_system_banned(item.user_id)
354
- if sibyl_result:
355
- sibyl_name, reason, is_banned, date_joined, sibyl_user_id = sibyl_result
356
- return SuccessResponse(
357
- status="True",
358
- randydev={
359
  "sibyl_name": sibyl_name,
360
  "reason": reason,
361
  "is_banned": is_banned,
362
  "date_joined": date_joined,
363
  "sibyl_user_id": sibyl_user_id
364
  }
365
- )
366
  else:
367
- return SuccessResponse(
368
- status="false",
369
- randydev={
370
- "message": "Not found user"
371
- }
372
- )
373
 
374
- @app.get("/ryuzaki/pypi-search", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
375
- def pypi_search(
376
- item: TextCustom,
 
377
  ):
378
  try:
379
- response = OpenReadSystem()
380
- response.code_system = f"pip3 show {item.query}"
381
- hack = response.show(read_system=True)
382
- return SuccessResponse(
383
- status="True",
384
- randydev={"results": hack})
385
- except:
386
- return SuccessResponse(
387
- status="True",
388
- randydev={"message": "Error not responding"})
 
 
 
 
 
 
 
 
 
 
 
 
389
 
390
- @app.get("/ryuzaki/translate", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
391
- def get_translate(
392
- item: TranslateCustom,
393
- ):
394
  try:
395
- source = trans.detect(item.text)
396
- translation = trans(item.text, sourcelang=source, targetlang=item.setlang)
397
- return SuccessResponse(
398
- status="True",
399
- randydev={
400
- "translation": translation.text,
401
- "translation_original": item.text
402
- }
403
- )
404
- except:
405
- return SuccessResponse(
406
- status="True",
407
- randydev={"message": "Error not responding"})
408
 
409
- @app.get("/ryuzaki/reverse", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
 
 
410
  def google_reverse(
411
- item: GoogleReverse,
 
 
 
412
  api_key: None = Depends(validate_api_key)
413
  ):
414
  params = {
415
  "api_key": REVERSE_IMAGE_API,
416
- "engine": item.engine,
417
- "image_url": item.image_url,
418
- "hl": item.language,
419
- "gl": item.google_lang
420
  }
421
  try:
422
  search = GoogleSearch(params)
@@ -425,28 +259,30 @@ def google_reverse(
425
  total_time_taken = results["search_metadata"]["total_time_taken"]
426
  create_at = results["search_metadata"]["created_at"]
427
  processed_at = results["search_metadata"]["processed_at"]
428
- return SuccessResponse(
429
- status="True",
430
- randydev={
431
  "link": link,
432
  "total_time_taken": total_time_taken,
433
  "create_at": create_at,
434
  "processed_at": processed_at
435
  }
436
- )
437
- except Exception:
438
- return {"status": "false", "message": "Internal server error"}
439
 
440
- @app.get("/ryuzaki/ocr", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
441
  def ocr_space_url(
442
- item: OrcSpaceUrl,
 
 
443
  api_key: None = Depends(validate_api_key)
444
  ):
445
  payload = {
446
- "url": item.url,
447
- "isOverlayRequired": item.overlay,
448
  "apikey": OCR_API_KEY,
449
- "language": item.language
450
  }
451
  try:
452
  response = requests.post(SOURCE_OCR_URL, data=payload)
@@ -457,403 +293,53 @@ def ocr_space_url(
457
  try:
458
  parsed_response = json.loads(test_url)
459
  if "ParsedResults" in parsed_response and len(parsed_response["ParsedResults"]) > 0:
460
- return SuccessResponse(
461
- status="True",
462
- randydev={
463
  "text": parsed_response["ParsedResults"][0]["ParsedText"]
464
  }
465
- )
466
  else:
467
  return {"status": "false", "message": "Error response."}
468
  except (json.JSONDecodeError, KeyError):
469
  return "Error parsing the OCR response."
470
 
471
- @app.get("/ryuzaki/freechatgpt-beta", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
472
- def free_chatgpt4_beta(item: ChatgptCustom):
473
- try:
474
- response = RendyDevChat(item.query).get_response_beta(joke=True)
475
- return SuccessResponse(
476
- status="True",
477
- randydev={
478
- "message": response
479
- }
480
- )
481
- except:
482
- return {"status": "false", "message": "Error response."}
483
-
484
- @app.get("/ryuzaki/freechatgpt-bing", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
485
- def free_chatgpt4_bing(item: ChatgptCustom):
486
- try:
487
- response = RendyDevChat(query).get_response_bing(bing=True)
488
- return SuccessResponse(
489
- status="True",
490
- randydev={
491
- "message": response
492
- }
493
- )
494
- except:
495
- return {"status": "false", "message": "Error response."}
496
-
497
- @app.post("/ryuzaki/ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
498
- def ryuzaki_ai(
499
- item: RyuzakiAi,
500
- api_key: None = Depends(validate_api_key)
501
- ):
502
- try:
503
- response_data = code.ryuzaki_ai_text(item.text)
504
-
505
- if isinstance(response_data, list) and len(response_data) > 0:
506
- first_result = response_data[0]
507
- if "generated_text" in first_result:
508
- message = first_result["generated_text"]
509
- return SuccessResponse(
510
- status="True",
511
- randydev={
512
- "ryuzaki_text": message
513
- }
514
- )
515
- return {"status": "false", "message": "Invalid response format"}
516
-
517
- except Exception:
518
- return {"status": "false", "message": "Internal server error"}
519
-
520
- @app.post("/ryuzaki/opendalle")
521
- def open_dalle(
522
- item: OpenDalle,
523
  api_key: None = Depends(validate_api_key)
524
  ):
525
- API_URL = SOURCE_OPENDALLE_URL
526
- try:
527
- payload = {"inputs": item.query}
528
- headers = {"Authorization": f"Bearer {HUGGING_TOKEN}"}
529
- response = requests.post(API_URL, headers=headers, json=payload)
530
- response.raise_for_status()
531
- except requests.exceptions.RequestException:
532
- raise HTTPException(
533
- status_code=500,
534
- detail=CustomErrorResponseModel(detail=[{}])
535
- )
536
  try:
537
- encoded_string = base64.b64encode(response.content).decode("utf-8")
538
- except Exception:
539
- raise HTTPException(
540
- status_code=500,
541
- detail=CustomErrorResponseModel(detail=[{}])
542
  )
543
- if encoded_string:
544
- return SuccessResponse(status="True", randydev={"data": encoded_string})
545
- else:
546
- return SuccessResponse(status="False", randydev={"data": "Not found image data"})
547
-
548
- @app.post("/ryuzaki/anime-styled")
549
- def Anime_Styled(
550
- item: AnimeStyled,
551
- api_key: None = Depends(validate_api_key)
552
- ):
553
- API_URL = SOURCE_ANIME_STYLED_URL
554
- try:
555
- payload = {"inputs": item.query}
556
- headers = {"Authorization": f"Bearer {HUGGING_TOKEN}"}
557
- response = requests.post(API_URL, headers=headers, json=payload)
558
- response.raise_for_status()
559
- except requests.exceptions.RequestException:
560
- raise HTTPException(
561
- status_code=500,
562
- detail=CustomErrorResponseModel(detail=[{}])
563
- )
564
- try:
565
- encoded_string = base64.b64encode(response.content).decode("utf-8")
566
- except Exception:
567
- raise HTTPException(
568
- status_code=500,
569
- detail=CustomErrorResponseModel(detail=[{}])
570
- )
571
- if encoded_string:
572
- return SuccessResponse(status="True", randydev={"data": encoded_string})
573
- else:
574
- return SuccessResponse(status="False", randydev={"data": "Not found image data"})
575
-
576
- @app.post("/ryuzaki/unsplash")
577
- def image_unsplash(item: GetImageUnsplash):
578
- url = SOURCE_UNSPLASH_URL
579
- image_url = f"{url}/?{item.query}/{item.size}"
580
- try:
581
- response = requests.get(image_url)
582
- response.raise_for_status()
583
- except requests.exceptions.RequestException:
584
- raise HTTPException(
585
- status_code=500,
586
- detail=CustomErrorResponseModel(detail=[{}])
587
- )
588
- try:
589
- encoded_string = base64.b64encode(response.content).decode("utf-8")
590
- except Exception:
591
- raise HTTPException(
592
- status_code=500,
593
- detail=CustomErrorResponseModel(detail=[{}])
594
- )
595
- if encoded_string:
596
- return SuccessResponse(status="True", randydev={"data": encoded_string})
597
- else:
598
- return SuccessResponse(status="False", randydev={"data": "Not found image data"})
599
-
600
- @app.post("/ryuzaki/chatgpt-model", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
601
- def chatgpt_model(item: ChatgptModel):
602
- url = "https://lexica.qewertyy.me/models"
603
- if item.is_models:
604
- params = {"model_id": item.model_id, "prompt": item.query}
605
- response = requests.post(url, params=params)
606
- if response.status_code != 200:
607
- return f"Error status: {response.status_code}"
608
- check_response = response.json()
609
- answer = check_response.get("content")
610
- return SuccessResponse(
611
- status="True",
612
- randydev={"message": answer}
613
- )
614
- else:
615
- params = {"model_id": 5, "prompt": item.query}
616
- response = requests.post(url, params=params)
617
- if response.status_code != 200:
618
- return f"Error status: {response.status_code}"
619
- check_response = response.json()
620
- answer = check_response.get("content")
621
- return SuccessResponse(
622
- status="True",
623
- randydev={"message": answer}
624
- )
625
-
626
- @app.post("/ryuzaki/chatgpt3-turbo", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
627
- def chatgpt3_turbo(item: Chatgpt3Texts):
628
- if item.is_openai_original:
629
- try:
630
- GPTbase = SOURCE_OPENAI_ACCESS_URL
631
- response = OpenAiToken(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
632
- query=item.query,
633
- model=item.model,
634
- is_stream=item.is_stream
635
- )
636
- answer = response[0]
637
- continue_chat = response[1]
638
- return SuccessResponse(
639
- status="True",
640
- randydev={
641
- "message": answer,
642
- "chat_history": continue_chat
643
- }
644
- )
645
- except Exception as e:
646
- return SuccessResponse(status="False", randydev={"message": f"Error responding: {e}"})
647
- else:
648
- url = "https://lexica.qewertyy.me/models"
649
- params = {"model_id": 5, "prompt": item.query}
650
- response = requests.post(url, params=params)
651
- if response.status_code != 200:
652
- return f"Error status: {response.status_code}"
653
- check_response = response.json()
654
- answer = check_response.get("content")
655
- return SuccessResponse(
656
- status="True",
657
- randydev={"message": answer}
658
- )
659
-
660
- @app.post("/ryuzaki/chatgpt4-turbo", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
661
- def chatgpt4_turbo(
662
- item: OpenaiTexts,
663
- api_key: None = Depends(validate_api_key)
664
- ):
665
- try:
666
- GPTbase = SOURCE_OPENAI_ACCESS_URL
667
- response = OpenAiToken(api_key=item.api_key, api_base=GPTbase).chat_message_turbo(
668
- query=item.query,
669
- model=item.model,
670
- is_stream=item.is_stream
671
- )
672
- if item.model == "gpt-5":
673
- return SuccessResponse(status="False", randydev={"message": "Coming Soon in 2024"})
674
- elif item.model == "gpt-5-turbo":
675
- return SuccessResponse(status="False", randydev={"message": "Coming Soon in 2024"})
676
- elif item.model == "gpt-5-plus":
677
- return SuccessResponse(status="False", randydev={"message": "Coming Soon in 2024"})
678
- answer = response[0]
679
- continue_chat = response[1]
680
- return SuccessResponse(
681
- status="True",
682
- randydev={
683
- "message": answer,
684
- "chat_history": continue_chat
685
- }
686
- )
687
- except Exception as e:
688
- return SuccessResponse(status="False", randydev={"message": f"Error responding: {e}"})
689
-
690
- @app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
691
- def v1beta3_google_ai(
692
- item: ChatgptCustom,
693
- api_key: None = Depends(validate_api_key)
694
- ):
695
- url = SOURCE_ASSISTANT_GOOGLE_AI
696
- token = ASSISTANT_GOOGLE_API_KEYS
697
- api_url = f"{SOURCE_ASSISTANT_GOOGLE_AI}/v1beta3/models/text-bison-001:generateText?key={ASSISTANT_GOOGLE_API_KEYS}"
698
- try:
699
- headers = {"Content-Type": "application/json"}
700
- data = {
701
- "prompt": {
702
- "text": item.query
703
  }
704
  }
705
- response = requests.post(api_url, headers=headers, json=data)
706
- response_str = response.json()
707
- answer = response_str["candidates"]
708
- for results in answer:
709
- message = results.get("output")
710
- return SuccessResponse(
711
- status="True",
712
- randydev={
713
- "message": message
714
- }
715
- )
716
  except:
717
  return {"status": "false", "message": "Error response."}
718
 
719
- #add too docker -e COOKIE_BARD_TOKEN="YOUR_VALUE_HERE" \
720
- #@app.post("/ryuzaki/gemini-ai-pro", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
721
- #def gemini_pro(
722
- # item: GeminiPro,
723
- # api_key: None = Depends(validate_api_key)
724
- #):
725
- # if item.is_login:
726
- # token = item.bard_api_key
727
- # else:
728
- # token = COOKIE_BARD_TOKEN
729
- # owner_base = f"""
730
- # Your name is Randy Dev. A kind and friendly AI assistant that answers in
731
- # a short and concise answer. Give short step-by-step reasoning if required.
732
- #
733
- # Today is {dt.now():%A %d %B %Y %H:%M}
734
- # """
735
- # try:
736
- # session = requests.Session()
737
- # session.headers = {
738
- # "Host": "bard.google.com",
739
- # "X-Same-Domain": "1",
740
- # "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
741
- # "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
742
- # "Origin": "https://bard.google.com",
743
- # "Referer": "https://bard.google.com/"
744
- # }
745
- # session.cookies.set("__Secure-1PSID", token)
746
- # bard = Bard(token=token, session=session, timeout=30)
747
- # bard.get_answer(owner_base)["content"]
748
- # message = bard.get_answer(item.query)["content"]
749
- # return SuccessResponse(
750
- # status="True",
751
- # randydev={
752
- # "message": message
753
- # }
754
- # )
755
- # except:
756
- # return {"status": "false", "message": "Error response."}
757
-
758
- @app.post("/ryuzaki/v1beta2-google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
759
- def v1beta2_google_ai(
760
- item: ChatgptCustom,
761
- api_key: None = Depends(validate_api_key)
762
  ):
763
- url = SOURCE_ASSISTANT_GOOGLE_AI
764
- token = ASSISTANT_GOOGLE_API_KEYS
765
- api_url = f"{SOURCE_ASSISTANT_GOOGLE_AI}/v1beta2/models/chat-bison-001:generateMessage?key={ASSISTANT_GOOGLE_API_KEYS}"
766
  try:
767
- headers = {"Content-Type": "application/json"}
768
- data = {
769
- "prompt": {
770
- "messages": [{"content": item.query}]}
771
- }
772
- response = requests.post(api_url, headers=headers, json=data)
773
- response_str = response.json()
774
- answer = response_str["candidates"]
775
- for results in answer:
776
- message = results.get("content")
777
- return SuccessResponse(
778
- status="True",
779
- randydev={
780
- "message": message
781
  }
782
- )
783
  except:
784
  return {"status": "false", "message": "Error response."}
785
 
786
- #@app.post("/ryuzaki/new-monitor", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
787
- #def new_monitor(
788
- # item: NewMonitor,
789
- # api_key: None = Depends(validate_api_key)
790
- #):
791
- # urls = SOURCE_MONITOR_URL
792
- # token = MONITOR_API_KEYS
793
- # api_url = f"{urls}/newMonitor"
794
- # try:
795
- # headers = {
796
- # "content-type": "application/x-www-form-urlencoded",
797
- # "cache-control": "no-cache"
798
- # }
799
- # payload = {
800
- # "api_key": token,
801
- # "format": "json",
802
- # "type": item.type,
803
- # "url": item.url,
804
- # "friendly_name": item.friendly_name
805
- # }
806
- # response = requests.post(api_url, data=payload, headers=headers)
807
- # response_str = response.json()
808
- # status_ok = response_str["stat"]
809
- # monitor_id = response_str["monitor"].get("id")
810
- # monitor_status = response_str["monitor"].get("status")
811
- # return {
812
- # "status": "true",
813
- # "randydev":{
814
- # "status_ok": status_ok,
815
- # "monitor_id": monitor_id,
816
- # "monitor_status": monitor_status
817
- # }
818
- # }
819
- # except:
820
- # return {"status": "false", "message": "Error response."}
821
-
822
- #@app.post("/ryuzaki/get-monitors", response_model=SuccessResponse, responses={422: {"model": ErrorResponse}})
823
- #def getMonitors(
824
- # item: GetMonitorLogs,
825
- # api_key: None = Depends(validate_api_key)
826
- #):
827
- # url = SOURCE_MONITOR_URL
828
- # token = MONITOR_API_KEYS
829
- # api_url = f"{url}/getMonitors"
830
- # try:
831
- # headers = {
832
- # "content-type": "application/x-www-form-urlencoded",
833
- # "cache-control": "no-cache"
834
- # }
835
- # payload = {
836
- # "api_key": token,
837
- # "format": "json",
838
- # "logs": item.logs
839
- # }
840
- # response = requests.post(api_url, data=payload, headers=headers)
841
- # response_str = response.json()
842
- # data = response_str["monitors"]
843
- # url_list = []
844
- # for x in data:
845
- # url = x.get("url")
846
- # if url:
847
- # url_list.append(url)
848
- # return {
849
- # "status": "true",
850
- # "randydev":{
851
- # "url": url_list,
852
- # }
853
- # }
854
- # except:
855
- # return {"status": "false", "message": "Error response."}
856
-
857
  async def get_data(username):
858
  base_msg = ""
859
  async with AsyncClient() as gpx:
@@ -882,10 +368,10 @@ async def get_data(username):
882
  base_msg += f"**An error occured while parsing the data!** \n\n**Traceback:** \n `{e}` \n\n`Make sure that you've sent the command with the correct username!`"
883
  return [base_msg, "https://telegra.ph//file/32f69c18190666ea96553.jpg"]
884
 
885
- @app.get("/ryuzaki/github", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
886
- async def github(item: GithubUsernames):
887
  try:
888
- details = await get_data(item.username)
889
  return {
890
  "status": "true",
891
  "randydev":{
@@ -896,10 +382,16 @@ async def github(item: GithubUsernames):
896
  except:
897
  return {"status": "false", "message": "Error response."}
898
 
899
- @app.get("/ryuzaki/webshot", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
900
- def webshot(item: Webshot):
 
 
 
 
 
 
901
  try:
902
- required_url = f"https://mini.s-shot.ru/{item.quality}/{item.type_mine}/{item.pixels}/{item.cast}/?{item.url}"
903
  return {
904
  "status": "true",
905
  "randydev":{
@@ -909,14 +401,19 @@ def webshot(item: Webshot):
909
  except:
910
  return {"status": "false", "message": "Error response."}
911
 
912
- @app.get("/ryuzaki/chatbot", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
913
- def chatbot(item: ChatBots):
 
 
 
 
 
914
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLmRldi9jaGF0Ym90").decode("utf-8")
915
  params = {
916
- "query": item.query,
917
- "user_id": item.user_id,
918
- "bot_name": item.bot_name,
919
- "bot_master": item.bot_username
920
  }
921
  x = requests.get(f"{api_url}", params=params)
922
  if x.status_code != 200:
@@ -933,29 +430,13 @@ def chatbot(item: ChatBots):
933
  except:
934
  return {"status": "false", "message": "Error response."}
935
 
936
- @app.get("/ryuzaki/llama", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
937
- def get_llama(item: ChatgptCustom):
938
- api_url = SOURCE_WHAT_GAY_URL
939
- params = {"query": item.query}
940
- x = requests.get(f"{api_url}/llama", params=params)
941
- if x.status_code != 200:
942
- return "Error api request"
943
- try:
944
- y = x.json()
945
- response = y["answer"]
946
- return {
947
- "status": "true",
948
- "randydev":{
949
- "message": response
950
- }
951
- }
952
- except:
953
- return {"status": "false", "message": "Error response."}
954
-
955
- @app.get("/ryuzaki/waifu", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
956
- def waifu_pics(item: WaifuPics):
957
- waifu_api = f"{SOURCE_WAIFU_URL}/{item.types}"
958
- waifu_param = f"{waifu_api}/{item.category}"
959
 
960
  response = requests.get(waifu_param)
961
 
@@ -967,40 +448,42 @@ def waifu_pics(item: WaifuPics):
967
  except Exception as e:
968
  return f"Error request {e}"
969
  if waifu_image_url:
970
- if item.is_bytes:
971
- try:
972
- response_two = requests.get(waifu_image_url)
973
- response_two.raise_for_status()
974
- except requests.exceptions.RequestException:
975
- raise HTTPException(status_code=500, detail="Internal server error")
976
- return StreamingResponse(BytesIO(response_two.content), media_type=item.media_type)
977
- else:
978
  return {
979
  "status": "true",
980
  "randydev":{
981
  "image_url": waifu_image_url
982
  }
983
  }
 
 
984
  else:
985
  return {"status": "false", "message": "Error response."}
986
 
987
- @app.get("/ryuzaki/rayso", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
988
- def make_rayso(item: MakeRayso):
 
 
 
 
 
 
 
989
  trans = SyncTranslator()
990
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLm1lL3JheXNv").decode("utf-8")
991
- if item.auto_translate:
992
- source = trans.detect(item.code)
993
- translation = trans(item.code, sourcelang=source, targetlang=item.setlang)
994
  code = translation.text
995
  else:
996
- code = item.code
997
- if item.ryuzaki_dark:
998
  x = requests.post(
999
  f"{api_url}",
1000
  json={
1001
  "code": code,
1002
- "title": item.title,
1003
- "theme": item.theme,
1004
  "darkMode": True
1005
  }
1006
  )
@@ -1022,8 +505,8 @@ def make_rayso(item: MakeRayso):
1022
  f"{api_url}",
1023
  json={
1024
  "code": code,
1025
- "title": item.title,
1026
- "theme": item.theme,
1027
  "darkMode": False
1028
  }
1029
  )
@@ -1088,11 +571,11 @@ def whois_ip_address(ip_address: str=None):
1088
  else:
1089
  return {"status": "false", "message": "Invalid ip address"}
1090
 
1091
- @app.get("/ryuzaki/tiktok_douyin", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1092
- def tiktok_douyin(item: TiktokDownloader):
1093
- response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={item.tiktok_url}")
1094
  if response.status_code != 200:
1095
- return "Internal server error"
1096
  try:
1097
  download_video = response.json()["aweme_list"][0]["video"]["play_addr"]["url_list"][0]
1098
  download_audio = response.json()["aweme_list"][0]["music"]["play_url"]["url_list"][0]
@@ -1112,10 +595,10 @@ def tiktok_douyin(item: TiktokDownloader):
1112
  except:
1113
  return {"status": "false", "message": "Error request"}
1114
 
1115
- @app.get("/ryuzaki/tiktok", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1116
- def tiktok_downloader(item: TiktokBeta):
1117
  api_devs = SOURCE_TIKTOK_TECH_URL
1118
- parameter = f"tiktok?url={item.tiktok_url}"
1119
  api_url = f"{api_devs}/{parameter}"
1120
  response = requests.get(api_url)
1121
 
@@ -1124,7 +607,7 @@ def tiktok_downloader(item: TiktokBeta):
1124
  try:
1125
  results = response.json()
1126
  caption = results.get("result", {}).get("desc", "")
1127
- if item.only_video:
1128
  video_url = results.get("result", {}).get("withoutWaterMarkVideo", "")
1129
  if video_url:
1130
  return {
@@ -1143,170 +626,190 @@ def tiktok_downloader(item: TiktokBeta):
1143
  return {"status": "false", "message": "Invalid Link"}
1144
 
1145
  @app.get("/ryuzaki/mediafire")
1146
- def mediafire(item: DownloadLink):
1147
- try:
1148
- down_link = str(item.link)
1149
- mid = down_link.split('/', 5)
1150
- if mid[3] == "view":
1151
- mid[3] = "file"
1152
- down_link = '/'.join(mid)
1153
- r = requests.get(down_link)
1154
- soup = BeautifulSoup(r.content, "html.parser")
1155
- a_href = soup.find("a", {"class": "input popsok"}).get("href")
1156
- a = str(a_href)
1157
- id = link.split('/', 5)[4]
1158
- a_byte = soup.find("a", {"class": "input popsok"}).get_text()
1159
- a_name = soup.find("div", {"class": "dl-btn-label"}).get_text()
1160
- details = soup.find("ul", {"class": "details"})
1161
- li_items = details.find_all('li')[1]
1162
- some = li_items.find_all("span")[0].get_text().split()
1163
- dat = list(some)
1164
- down = a_byte.replace(" ", "").strip()
1165
- time = dat[1]
1166
- date = dat[0]
1167
- byte = down.split("(", 1)[1].split(")", 1)[0]
1168
- name = a_name.replace(" ", "").strip()
1169
- return SuccessResponse(
1170
- status="True",
1171
- randydev={
1172
- "directDownload": a,
1173
- "original": item.link,
1174
- "id": id,
1175
- "name": name,
1176
- "readable": byte,
1177
- "time": byte,
1178
- "date": date
 
 
 
 
 
 
 
 
1179
  }
1180
- )
1181
- except:
1182
- return {'status': 'false', 'message': 'Invalid Link'}
 
 
 
 
 
1183
 
1184
  @app.get("/ryuzaki/gdrive")
1185
- def gdrive(item: DownloadLink):
1186
- try:
1187
- down = link.split('/', 6)
1188
- url = f'https://drive.google.com/uc?export=download&id={down[5]}'
1189
- session = requests.Session()
1190
- response = session.get(url, stream=True)
1191
- headers = response.headers
1192
- content_disp = headers.get('content-disposition')
1193
- filename = None
1194
- if content_disp:
1195
- match = re.search(r'filename="(.+)"', content_disp)
1196
- if match:
1197
- filename = match.group(1)
1198
- content_length = headers.get('content-length')
1199
- last_modified = headers.get('last-modified')
1200
- content_type = headers.get('content-type')
1201
- return SuccessResponse(
1202
- status="True",
1203
- randydev={
1204
- "directDownload": url,
1205
- "original": item.link,
1206
- "id": down[5],
1207
- "name": filename if filename else "No filename provided by the server.",
1208
- "readable": f"{round(int(content_length) / (1024 * 1024), 2)} MB" if content_length else "No content length provided by the server.",
1209
- "type": content_type if content_type else "No content type provided by the server.",
1210
- "DateAndTime": last_modified if last_modified else "No last modified date provided by the server."
1211
- }
1212
- )
1213
- except:
1214
- return {'status': 'false', 'message': 'Invalid Link'}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1215
 
1216
  @app.get("/ryuzaki/anonfiles")
1217
- def anonfiles(item: DownloadLink):
1218
- try:
1219
- r = requests.get(item.link)
1220
- soup = BeautifulSoup(r.content, "html.parser")
1221
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1222
- a = str(a_href)
1223
- id = link.split('/', 4)[3]
1224
- jsondata = requests.get(f'https://api.anonfiles.com/v2/file/{id}/info').json()
1225
- jsondata['data']['file']['url']['directDownload'] = a
1226
- del jsondata['data']['file']['url']['full']
1227
- return jsondata
1228
- except:
1229
- return "{'status': 'false', 'message': 'Invalid Link'}"
 
 
1230
 
1231
  @app.get("/ryuzaki/filechan")
1232
- def filechan(item: DownloadLink):
1233
- try:
1234
- r = requests.get(item.link)
1235
- soup = BeautifulSoup(r.content, "html.parser")
1236
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1237
- a = str(a_href)
1238
- id = link.split('/', 4)[3]
1239
- jsondata = requests.get(f'https://api.filechan.org/v2/file/{id}/info').json()
1240
- jsondata['data']['file']['url']['directDownload'] = a
1241
- del jsondata['data']['file']['url']['full']
1242
- return jsondata
1243
- except:
1244
- return {'status': 'false', 'message': 'Invalid Link'}
 
 
1245
 
1246
  @app.get("/ryuzaki/letsupload")
1247
- def letsupload(item: DownloadLink):
1248
- try:
1249
- r = requests.get(item.link)
1250
- soup = BeautifulSoup(r.content, "html.parser")
1251
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1252
- a = str(a_href)
1253
- id = link.split('/', 4)[3]
1254
- jsondata = requests.get(f'https://api.letsupload.cc/v2/file/{id}/info').json()
1255
- jsondata['data']['file']['url']['directDownload'] = a
1256
- del jsondata['data']['file']['url']['full']
1257
- return jsondata
1258
- except:
1259
- return {'status': 'false', 'message': 'Invalid Link'}
 
 
1260
 
1261
  @app.get("/ryuzaki/megaupload")
1262
- def megaupload(item: DownloadLink):
1263
- try:
1264
- r = requests.get(item.link)
1265
- soup = BeautifulSoup(r.content, "html.parser")
1266
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1267
- a = str(a_href)
1268
- id = link.split('/', 4)[3]
1269
- jsondata = requests.get(f'https://api.megaupload.nz/v2/file/{id}/info').json()
1270
- jsondata['data']['file']['url']['directDownload'] = a
1271
- del jsondata['data']['file']['url']['full']
1272
- return jsondata
1273
- except:
1274
- return {'status': 'false', 'message': 'Invalid Link'}
 
 
1275
 
1276
  @app.get("/ryuzaki/myfile")
1277
- def myfile(item: DownloadLink):
1278
- try:
1279
- r = requests.get(item.link)
1280
- soup = BeautifulSoup(r.content, "html.parser")
1281
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1282
- a = str(a_href)
1283
- id = link.split('/', 4)[3]
1284
- jsondata = requests.get(f'https://api.myfile.is/v2/file/{id}/info').json()
1285
- jsondata['data']['file']['url']['directDownload'] = a
1286
- del jsondata['data']['file']['url']['full']
1287
- return jsondata
1288
- except:
1289
- return {'status': 'false', 'message': 'Invalid Link'}
1290
-
1291
- description = """
1292
- - Ryuzaki Library: [Library Here](https://github.com/TeamKillerX/RyuzakiLib)
1293
-
1294
- β€’Developed by [@xtdevs](https://t.me/xtdevs)
1295
- """
1296
- def custom_openapi():
1297
- if app.openapi_schema:
1298
- return app.openapi_schema
1299
- openapi_schema = get_openapi(
1300
- title="RyuzakiLib API",
1301
- version="2.2.1",
1302
- summary="Use It Only For Personal Project Else I Need To Delete The Api",
1303
- description=description,
1304
- routes=app.routes,
1305
- )
1306
- openapi_schema["info"]["x-logo"] = {
1307
- "url": "https://github-production-user-asset-6210df.s3.amazonaws.com/90479255/289277800-f26513f7-cdf4-44ee-9a08-f6b27e6b99f7.jpg"
1308
- }
1309
- app.openapi_schema = openapi_schema
1310
- return app.openapi_schema
1311
-
1312
- app.openapi = custom_openapi
 
25
  import os
26
  import shutil
27
  import random
28
+ import g4f
29
  import tempfile
30
  import io
 
31
  from io import BytesIO
32
  from datetime import datetime as dt
33
  from dotenv import load_dotenv
34
  from bs4 import BeautifulSoup
35
 
36
+ from typing import Union
37
  from typing_extensions import Annotated
38
  from typing import Annotated, Union
 
 
39
 
40
  from pydantic import BaseModel
41
  from base64 import b64decode as kc
 
47
  from pathlib import Path
48
  from serpapi import GoogleSearch
49
 
50
+ from fastapi import FastAPI, UploadFile, File
51
  from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
52
  from fastapi import Depends, FastAPI, HTTPException, status
 
53
  from fastapi.responses import StreamingResponse
54
  from fastapi import HTTPException
55
  from fastapi import FastAPI, Request, Header
 
58
  from fastapi.templating import Jinja2Templates
59
  from fastapi.responses import FileResponse
60
 
 
 
61
  from RyuzakiLib.hackertools.chatgpt import RendyDevChat
62
  from RyuzakiLib.hackertools.openai_api import OpenAiToken
63
  from RyuzakiLib.mental import BadWordsList
64
+ from RyuzakiLib.spamwatch.clients import SibylBan
 
 
 
 
 
 
65
 
66
  import logging
67
+ import database as db
68
  import functions as code
69
 
70
  logging.basicConfig(level=logging.ERROR)
71
 
72
+ # I DON'T KNOW LIKE THIS HACKER
73
  load_dotenv()
74
+ REVERSE_IMAGE_API = os.environ["REVERSE_IMAGE_API"]
75
+ OCR_API_KEY = os.environ["OCR_API_KEY"]
76
+ ONLY_DEVELOPER_API_KEYS = os.environ["ONLY_DEVELOPER_API_KEYS"]
77
+ HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
 
78
  SOURCE_UNSPLASH_URL = os.environ["SOURCE_UNSPLASH_URL"]
79
  SOURCE_OCR_URL = os.environ["SOURCE_OCR_URL"]
80
  SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
81
+ SOURCE_WAIFU_URL = "https://api.waifu.pics"
 
 
82
  SOURCE_TIKTOK_WTF_URL = os.environ["SOURCE_TIKTOK_WTF_URL"]
83
  SOURCE_TIKTOK_TECH_URL = os.environ["SOURCE_TIKTOK_TECH_URL"]
84
+ DEVELOPER_ID = os.environ["DEVELOPER_ID"]
 
 
85
 
86
+ description = """
87
+ ~ Developed written and powered by
88
+ - Ryuzaki Library: [Library Here](https://github.com/TeamKillerX/RyuzakiLib)
89
+ """
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ app = FastAPI(
92
+ title="UFoP-API",
93
+ description=description,
94
+ version="0.1.0",
95
+ terms_of_service="Use It Only For Personal Project Else I Need To Delete The Api",
96
+ contact={
97
+ "name": "πŸŒ€ΚŠΚ„βŠ•Φ„πŸŒ€",
98
+ "url": "https://t.me/UFoPInfo",
99
+ },
100
+ docs_url="/"
101
+ )
102
 
103
  def validate_api_key(api_key: str = Header(...)):
104
+ USERS_API_KEYS = db.get_all_api_keys()
105
  if api_key not in USERS_API_KEYS:
106
  raise HTTPException(status_code=401, detail="Invalid API key")
107
 
 
109
  if api_key not in ONLY_DEVELOPER_API_KEYS:
110
  raise HTTPException(status_code=401, detail="Invalid API key")
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  @app.get("/UFoP/getbanlist")
114
  def sibyl_get_all_banlist():
115
+ banned_users = db.get_all_banned()
116
  return {
117
  "status": "True",
118
  "randydev": {
 
120
  }
121
  }
122
 
123
+ @app.get("/UFoP/blacklist-words")
124
  def blacklist_words():
125
  try:
126
  BLACKLIST_WORDS = BadWordsList()
 
129
  except Exception as e:
130
  return {"status": "false", "message": f"Internal server error: {str(e)}"}
131
 
132
+ @app.delete("/UFoP/bandel")
133
  def sibyl_system_delete(
134
+ user_id: int = Query(..., description="User ID in query parameter only developer"),
135
  api_key: None = Depends(validate_api_key_only_devs)
136
  ):
137
  try:
138
+ _, _, _, _, sibyl_user_id = db.get_sibyl_system_banned(user_id)
139
 
140
  if sibyl_user_id:
141
+ db.remove_sibyl_system_banned(user_id)
142
+ return {"status": "true", "message": f"Successfully removed {user_id} from the Sibyl ban list."}
 
 
 
143
  else:
144
+ return {"status": "false", "message": "Not found user"}
 
 
 
145
  except Exception as e:
146
+ return {"status": "false", "message": f"Internal server error: {str(e)}"}
147
 
148
+ @app.post("/UFoP/banner")
149
  def sibyl_system_ban(
150
+ user_id: int = Query(..., description="User ID in query parameter"),
151
+ reason: str = Query(..., description="Reason in query parameter"),
152
  api_key: None = Depends(validate_api_key_only_devs)
153
  ):
154
+ if user_id == int(DEVELOPER_ID):
155
  return {"status": "false", "message": "Only Developer"}
156
 
157
  try:
158
  date_joined = str(dt.now())
159
+ sibyl_ban = random.choice(db.RAMDOM_STATUS)
160
+ ban_data = db.get_sibyl_system_banned(user_id)
161
+
162
+ if ban_data is not None:
163
+ _, _, is_banned, _, sibyl_user_id = ban_data
164
  return {"status": "false", "message": "User is already banned"}
165
 
166
+ db.new_sibyl_system_banned(user_id, sibyl_ban, reason, date_joined)
167
+
168
+ return {
169
+ "status": "true",
170
+ "randydev": {
171
+ "user_id": user_id,
172
  "sibyl_name": sibyl_ban,
173
+ "reason": reason,
174
  "date_joined": date_joined,
175
+ "message": f"Successfully banned {user_id} from the Sibyl ban list."
176
  }
177
+ }
178
  except Exception as e:
179
+ logging.error(f"Error in sibyl_system_ban: {e}")
180
+ return {"status": "false", "message": "Internal server error"}
181
 
182
+ @app.get("/UFoP/bans")
183
  def sibyl_system(
184
+ user_id: int = Query(..., description="User ID in query parameter"),
185
+ api_key: None = Depends(validate_api_key) or Depends(validate_api_key_only_devs)
186
  ):
187
+ result = db.get_sibyl_system_banned(user_id)
188
+ if result is not None:
189
+ sibyl_name, reason, is_banned, date_joined, sibyl_user_id = result
190
+ return {
191
+ "status": "true",
192
+ "randydev": {
193
  "sibyl_name": sibyl_name,
194
  "reason": reason,
195
  "is_banned": is_banned,
196
  "date_joined": date_joined,
197
  "sibyl_user_id": sibyl_user_id
198
  }
199
+ }
200
  else:
201
+ return {"status": "false", "message": "Not Found User"}
 
 
 
 
 
202
 
203
+ @app.get("/ryuzaki/ai")
204
+ def ryuzaki_ai(
205
+ text: str = Query(..., description="text in query parameter"),
206
+ api_key: None = Depends(validate_api_key_only_devs)
207
  ):
208
  try:
209
+ response_data = code.ryuzaki_ai_text(text)
210
+
211
+ if isinstance(response_data, list) and len(response_data) > 0:
212
+ first_result = response_data[0]
213
+ if "generated_text" in first_result:
214
+ message = first_result["generated_text"]
215
+ return {
216
+ "status": "true",
217
+ "randydev": {
218
+ "ryuzaki_text": message
219
+ }
220
+ }
221
+
222
+ return {"status": "false", "message": "Invalid response format"}
223
+
224
+ except Exception as e:
225
+ return {"status": "false", "message": f"error: {e}"}
226
+
227
+ @app.get("/ryuzaki/unsplash")
228
+ async def get_image_unsplash(query: str, size: str="500x500"):
229
+ url = SOURCE_UNSPLASH_URL
230
+ image_url = f"{url}/?{query}/{size}"
231
 
 
 
 
 
232
  try:
233
+ response = requests.get(image_url)
234
+ response.raise_for_status()
235
+ except requests.exceptions.RequestException as e:
236
+ raise HTTPException(status_code=500, detail=f"Error fetching image: {e}")
 
 
 
 
 
 
 
 
 
237
 
238
+ return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
239
+
240
+ @app.get("/ryuzaki/reverse")
241
  def google_reverse(
242
+ engine: str="google_reverse_image",
243
+ image_url: str=None,
244
+ language: str="en",
245
+ google_lang: str="us",
246
  api_key: None = Depends(validate_api_key)
247
  ):
248
  params = {
249
  "api_key": REVERSE_IMAGE_API,
250
+ "engine": engine,
251
+ "image_url": image_url,
252
+ "hl": language,
253
+ "gl": google_lang
254
  }
255
  try:
256
  search = GoogleSearch(params)
 
259
  total_time_taken = results["search_metadata"]["total_time_taken"]
260
  create_at = results["search_metadata"]["created_at"]
261
  processed_at = results["search_metadata"]["processed_at"]
262
+ return {
263
+ "status": "true",
264
+ "randydev": {
265
  "link": link,
266
  "total_time_taken": total_time_taken,
267
  "create_at": create_at,
268
  "processed_at": processed_at
269
  }
270
+ }
271
+ except Exception as e:
272
+ return {"status": "false", "message": f"Error {e}"}
273
 
274
+ @app.get("/ryuzaki/ocr")
275
  def ocr_space_url(
276
+ url: str = Query(..., description="URL in query parameter"),
277
+ overlay: bool=False,
278
+ language: str = Query("eng", description="Language in query parameter"),
279
  api_key: None = Depends(validate_api_key)
280
  ):
281
  payload = {
282
+ "url": url,
283
+ "isOverlayRequired": overlay,
284
  "apikey": OCR_API_KEY,
285
+ "language": language
286
  }
287
  try:
288
  response = requests.post(SOURCE_OCR_URL, data=payload)
 
293
  try:
294
  parsed_response = json.loads(test_url)
295
  if "ParsedResults" in parsed_response and len(parsed_response["ParsedResults"]) > 0:
296
+ return {
297
+ "status": "true",
298
+ "randydev":{
299
  "text": parsed_response["ParsedResults"][0]["ParsedText"]
300
  }
301
+ }
302
  else:
303
  return {"status": "false", "message": "Error response."}
304
  except (json.JSONDecodeError, KeyError):
305
  return "Error parsing the OCR response."
306
 
307
+ @app.get("/ryuzaki/chatgpt4")
308
+ def chatgpt4_support(
309
+ query: str=None,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  api_key: None = Depends(validate_api_key)
311
  ):
 
 
 
 
 
 
 
 
 
 
 
312
  try:
313
+ response = g4f.ChatCompletion.create(
314
+ model=g4f.models.gpt_4,
315
+ messages=[{"role": "user", "content": query}],
 
 
316
  )
317
+ return {
318
+ "status": "true",
319
+ "randydev":{
320
+ "message": response
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  }
322
  }
 
 
 
 
 
 
 
 
 
 
 
323
  except:
324
  return {"status": "false", "message": "Error response."}
325
 
326
+ @app.post("/ryuzaki/chatgpt-model")
327
+ def chatgpt_model(
328
+ query: str=None,
329
+ model_id: int=1,
330
+ is_models: bool=True
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  ):
 
 
 
332
  try:
333
+ response = RendyDevChat(query).get_response_model(model_id=model_id, is_models=is_models)
334
+ return {
335
+ "status": "true",
336
+ "randydev":{
337
+ "message": response
 
 
 
 
 
 
 
 
 
338
  }
339
+ }
340
  except:
341
  return {"status": "false", "message": "Error response."}
342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  async def get_data(username):
344
  base_msg = ""
345
  async with AsyncClient() as gpx:
 
368
  base_msg += f"**An error occured while parsing the data!** \n\n**Traceback:** \n `{e}` \n\n`Make sure that you've sent the command with the correct username!`"
369
  return [base_msg, "https://telegra.ph//file/32f69c18190666ea96553.jpg"]
370
 
371
+ @app.get("/ryuzaki/github")
372
+ async def github(username: str=None):
373
  try:
374
+ details = await get_data(username)
375
  return {
376
  "status": "true",
377
  "randydev":{
 
382
  except:
383
  return {"status": "false", "message": "Error response."}
384
 
385
+ @app.get("/ryuzaki/webshot")
386
+ def webshot(
387
+ url: str=None,
388
+ quality: str="1920x1080",
389
+ type_mine: str="JPEG",
390
+ pixels: str="1024",
391
+ cast: str="Z100"
392
+ ):
393
  try:
394
+ required_url = f"https://mini.s-shot.ru/{quality}/{type_mine}/{pixels}/{cast}/?{url}"
395
  return {
396
  "status": "true",
397
  "randydev":{
 
401
  except:
402
  return {"status": "false", "message": "Error response."}
403
 
404
+ @app.get("/ryuzaki/chatbot")
405
+ def chatbot(
406
+ query: str=None,
407
+ user_id: int=None,
408
+ bot_name: str=None,
409
+ bot_username: str=None
410
+ ):
411
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLmRldi9jaGF0Ym90").decode("utf-8")
412
  params = {
413
+ "query": query,
414
+ "user_id": user_id,
415
+ "bot_name": bot_name,
416
+ "bot_master": bot_username
417
  }
418
  x = requests.get(f"{api_url}", params=params)
419
  if x.status_code != 200:
 
430
  except:
431
  return {"status": "false", "message": "Error response."}
432
 
433
+ @app.get("/ryuzaki/waifu")
434
+ def waifu_pics(
435
+ types: str="sfw",
436
+ category: str="neko"
437
+ ):
438
+ waifu_api = f"{SOURCE_WAIFU_URL}/{types}"
439
+ waifu_param = f"{waifu_api}/{category}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
 
441
  response = requests.get(waifu_param)
442
 
 
448
  except Exception as e:
449
  return f"Error request {e}"
450
  if waifu_image_url:
451
+ try:
 
 
 
 
 
 
 
452
  return {
453
  "status": "true",
454
  "randydev":{
455
  "image_url": waifu_image_url
456
  }
457
  }
458
+ except:
459
+ return {"status": "false", "message": "Error response"}
460
  else:
461
  return {"status": "false", "message": "Error response."}
462
 
463
+ @app.get("/ryuzaki/rayso")
464
+ def make_rayso(
465
+ code=None,
466
+ title: str="Ryuzaki Dev",
467
+ theme: str=None,
468
+ setlang: str="en",
469
+ auto_translate: bool=None,
470
+ ryuzaki_dark: bool=None
471
+ ):
472
  trans = SyncTranslator()
473
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLm1lL3JheXNv").decode("utf-8")
474
+ if auto_translate:
475
+ source = trans.detect(code)
476
+ translation = trans(code, sourcelang=source, targetlang=setlang)
477
  code = translation.text
478
  else:
479
+ code = code
480
+ if ryuzaki_dark:
481
  x = requests.post(
482
  f"{api_url}",
483
  json={
484
  "code": code,
485
+ "title": title,
486
+ "theme": theme,
487
  "darkMode": True
488
  }
489
  )
 
505
  f"{api_url}",
506
  json={
507
  "code": code,
508
+ "title": title,
509
+ "theme": theme,
510
  "darkMode": False
511
  }
512
  )
 
571
  else:
572
  return {"status": "false", "message": "Invalid ip address"}
573
 
574
+ @app.get("/ryuzaki/tiktok_douyin")
575
+ def tiktok_douyin(tiktok_url: str=None):
576
+ response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={tiktok_url}")
577
  if response.status_code != 200:
578
+ return "Error request:"
579
  try:
580
  download_video = response.json()["aweme_list"][0]["video"]["play_addr"]["url_list"][0]
581
  download_audio = response.json()["aweme_list"][0]["music"]["play_url"]["url_list"][0]
 
595
  except:
596
  return {"status": "false", "message": "Error request"}
597
 
598
+ @app.get("/ryuzaki/tiktok")
599
+ def tiktok_downloader(tiktok_url: Union[str, None] = None, only_video: bool=None):
600
  api_devs = SOURCE_TIKTOK_TECH_URL
601
+ parameter = f"tiktok?url={tiktok_url}"
602
  api_url = f"{api_devs}/{parameter}"
603
  response = requests.get(api_url)
604
 
 
607
  try:
608
  results = response.json()
609
  caption = results.get("result", {}).get("desc", "")
610
+ if only_video:
611
  video_url = results.get("result", {}).get("withoutWaterMarkVideo", "")
612
  if video_url:
613
  return {
 
626
  return {"status": "false", "message": "Invalid Link"}
627
 
628
  @app.get("/ryuzaki/mediafire")
629
+ def mediafire(link: Union[str, None] = None):
630
+ try:
631
+ down_link = str(link)
632
+ mid = down_link.split('/', 5)
633
+ if mid[3] == "view":
634
+ mid[3] = "file"
635
+ down_link = '/'.join(mid)
636
+ print(down_link)
637
+ r = requests.get(down_link)
638
+ soup = BeautifulSoup(r.content, "html.parser")
639
+ a_href = soup.find("a", {"class": "input popsok"}).get("href")
640
+ a = str(a_href)
641
+ id = link.split('/', 5)[4]
642
+ a_byte = soup.find("a", {"class": "input popsok"}).get_text()
643
+ a_name = soup.find("div", {"class": "dl-btn-label"}).get_text()
644
+ details = soup.find("ul", {"class": "details"})
645
+ li_items = details.find_all('li')[1]
646
+ some = li_items.find_all("span")[0].get_text().split()
647
+ dat = list(some)
648
+ down = a_byte.replace(" ", "").strip()
649
+ time = dat[1]
650
+ date = dat[0]
651
+ byte = down.split("(", 1)[1].split(")", 1)[0]
652
+ name = a_name.replace(" ", "").strip()
653
+ return {
654
+ "status": "true",
655
+ "data": {
656
+ "file": {
657
+ "url": {
658
+ 'directDownload': a,
659
+ "original": link,
660
+ },
661
+ "metadata": {
662
+ "id": id,
663
+ "name": name,
664
+ "size": {
665
+ "readable": byte
666
+ },
667
+ "DateAndTime": {
668
+ "time": time,
669
+ "date": date
670
  }
671
+ }
672
+ }
673
+ }
674
+ }
675
+
676
+ except:
677
+ return "{'status': 'false', 'message': 'Invalid Link'}"
678
+
679
 
680
  @app.get("/ryuzaki/gdrive")
681
+ def gdrive(link: Union[str, None] = None):
682
+ try:
683
+ down = link.split('/', 6)
684
+ url = f'https://drive.google.com/uc?export=download&id={down[5]}'
685
+ session = requests.Session()
686
+
687
+ response = session.get(url, stream=True)
688
+ headers = response.headers
689
+ content_disp = headers.get('content-disposition')
690
+ filename = None
691
+ if content_disp:
692
+ match = re.search(r'filename="(.+)"', content_disp)
693
+ if match:
694
+ filename = match.group(1)
695
+
696
+ content_length = headers.get('content-length')
697
+ last_modified = headers.get('last-modified')
698
+ content_type = headers.get('content-type')
699
+
700
+ return {
701
+ "status": "true",
702
+ "data": {
703
+ "file": {
704
+ "url": {
705
+ 'directDownload': url,
706
+ "original": link,
707
+ },
708
+ "metadata": {
709
+ "id":
710
+ down[5],
711
+ "name":
712
+ filename if filename else 'No filename provided by the server.',
713
+ "size": {
714
+ "readable":
715
+ f'{round(int(content_length) / (1024 * 1024), 2)} MB' if
716
+ content_length else 'No content length provided by the server.',
717
+ "type":
718
+ content_type
719
+ if content_type else 'No content type provided by the server.'
720
+ },
721
+ "DateAndTime":
722
+ last_modified if last_modified else
723
+ 'No last modified date provided by the server.',
724
+ }
725
+ }
726
+ }
727
+ }
728
+
729
+ except:
730
+ return "{'status': 'false', 'message': 'Invalid Link'}"
731
 
732
  @app.get("/ryuzaki/anonfiles")
733
+ def anonfiles(link: Union[str, None] = None):
734
+ try:
735
+ r = requests.get(link)
736
+ soup = BeautifulSoup(r.content, "html.parser")
737
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
738
+ a = str(a_href)
739
+ id = link.split('/', 4)[3]
740
+ jsondata = requests.get(
741
+ f'https://api.anonfiles.com/v2/file/{id}/info').json()
742
+ jsondata['data']['file']['url']['directDownload'] = a
743
+ del jsondata['data']['file']['url']['full']
744
+
745
+ return jsondata
746
+ except:
747
+ return "{'status': 'false', 'message': 'Invalid Link'}"
748
 
749
  @app.get("/ryuzaki/filechan")
750
+ def filechan(link: Union[str, None] = None):
751
+ try:
752
+ r = requests.get(link)
753
+ soup = BeautifulSoup(r.content, "html.parser")
754
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
755
+ a = str(a_href)
756
+ id = link.split('/', 4)[3]
757
+ jsondata = requests.get(
758
+ f'https://api.filechan.org/v2/file/{id}/info').json()
759
+ jsondata['data']['file']['url']['directDownload'] = a
760
+ del jsondata['data']['file']['url']['full']
761
+
762
+ return jsondata
763
+ except:
764
+ return "{'status': 'false', 'message': 'Invalid Link'}"
765
 
766
  @app.get("/ryuzaki/letsupload")
767
+ def letsupload(link: Union[str, None] = None):
768
+ try:
769
+ r = requests.get(link)
770
+ soup = BeautifulSoup(r.content, "html.parser")
771
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
772
+ a = str(a_href)
773
+ id = link.split('/', 4)[3]
774
+ jsondata = requests.get(
775
+ f'https://api.letsupload.cc/v2/file/{id}/info').json()
776
+ jsondata['data']['file']['url']['directDownload'] = a
777
+ del jsondata['data']['file']['url']['full']
778
+
779
+ return jsondata
780
+ except:
781
+ return "{'status': 'false', 'message': 'Invalid Link'}"
782
 
783
  @app.get("/ryuzaki/megaupload")
784
+ def megaupload(link: Union[str, None] = None):
785
+ try:
786
+ r = requests.get(link)
787
+ soup = BeautifulSoup(r.content, "html.parser")
788
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
789
+ a = str(a_href)
790
+ id = link.split('/', 4)[3]
791
+ jsondata = requests.get(
792
+ f'https://api.megaupload.nz/v2/file/{id}/info').json()
793
+ jsondata['data']['file']['url']['directDownload'] = a
794
+ del jsondata['data']['file']['url']['full']
795
+
796
+ return jsondata
797
+ except:
798
+ return "{'status': 'false', 'message': 'Invalid Link'}"
799
 
800
  @app.get("/ryuzaki/myfile")
801
+ def myfile(link: Union[str, None] = None):
802
+ try:
803
+ r = requests.get(link)
804
+ soup = BeautifulSoup(r.content, "html.parser")
805
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
806
+ a = str(a_href)
807
+ id = link.split('/', 4)[3]
808
+ jsondata = requests.get(
809
+ f'https://api.myfile.is/v2/file/{id}/info').json()
810
+ jsondata['data']['file']['url']['directDownload'] = a
811
+ del jsondata['data']['file']['url']['full']
812
+
813
+ return jsondata
814
+ except:
815
+ return "{'status': 'false', 'message': 'Invalid Link'}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,8 +1,8 @@
1
  requests
2
  pymongo
3
  bs4
4
- git+https://github.com/TeamKillerX/RyuzakiLib
5
- openai==0.28.0
6
  uvicorn
7
  gpytranslate
8
  google-search-results
@@ -24,4 +24,3 @@ typing-extensions
24
  uvicorn[standard]
25
  uvloop
26
  stripe
27
- bardapi
 
1
  requests
2
  pymongo
3
  bs4
4
+ g4f
5
+ RyuzakiLib
6
  uvicorn
7
  gpytranslate
8
  google-search-results
 
24
  uvicorn[standard]
25
  uvloop
26
  stripe