randydev commited on
Commit
08b5cce
1 Parent(s): 52a1d3d

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +122 -139
main.py CHANGED
@@ -86,7 +86,6 @@ SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
86
  SOURCE_WAIFU_URL = os.environ["SOURCE_WAIFU_URL"]
87
  SOURCE_TIKTOK_WTF_URL = os.environ["SOURCE_TIKTOK_WTF_URL"]
88
  SOURCE_TIKTOK_TECH_URL = os.environ["SOURCE_TIKTOK_TECH_URL"]
89
- SOURCE_CALLI_GRAPHY_URL = os.environ["SOURCE_CALLI_GRAPHY_URL"]
90
  SOURCE_WHAT_GAY_URL = os.environ["SOURCE_WHAT_GAY_URL"]
91
  SOURCE_ASSISTANT_GOOGLE_AI = os.environ["SOURCE_ASSISTANT_GOOGLE_AI"]
92
  SOURCE_MONITOR_URL = os.environ["SOURCE_MONITOR_URL"]
@@ -241,6 +240,13 @@ class RyuzakiAi(BaseModel):
241
  class SibylSystem(BaseModel):
242
  user_id: int
243
 
 
 
 
 
 
 
 
244
  class GoogleReverse(BaseModel):
245
  engine: str="google_reverse_image"
246
  image_url: str
@@ -314,6 +320,9 @@ class TiktokDownloader(BaseModel):
314
  class GetMonitorLogs(BaseModel):
315
  logs: int
316
 
 
 
 
317
  @app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
318
  def profile_clone(
319
  item: ProfileClone,
@@ -444,25 +453,28 @@ def sibyl_system_ban(
444
  except Exception as e:
445
  return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
446
 
447
- @app.get("/ryuzaki/sibyl", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
448
  def sibyl_system(
449
  item: SibylSystem,
450
  api_key: None = Depends(validate_api_key)
451
  ):
452
  sibyl_name, reason, is_banned, date_joined, sibyl_user_id = get_sibyl_system_banned(item.user_id)
453
  if sibyl_name and reason and is_banned and date_joined and sibyl_user_id:
454
- return SuccessResponse(
455
- status="True",
456
- randydev={
457
- "sibyl_name": sibyl_name,
458
- "reason": reason,
459
- "is_banned": is_banned,
460
- "date_joined": date_joined,
461
- "sibyl_user_id": sibyl_user_id
462
- }
463
  )
464
  else:
465
- return ErrorStatus(status="false", message="Not found user")
 
 
 
 
 
 
466
 
467
  @app.get("/ryuzaki/ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
468
  def ryuzaki_ai(
@@ -1086,9 +1098,9 @@ def tiktok_downloader(item: TiktokBeta):
1086
  return {"status": "false", "message": "Invalid Link"}
1087
 
1088
  @app.get("/ryuzaki/mediafire")
1089
- def mediafire(link: Union[str, None] = None):
1090
  try:
1091
- down_link = str(link)
1092
  mid = down_link.split('/', 5)
1093
  if mid[3] == "view":
1094
  mid[3] = "file"
@@ -1113,7 +1125,7 @@ def mediafire(link: Union[str, None] = None):
1113
  status="True",
1114
  randydev={
1115
  "directDownload": a,
1116
- "original": link,
1117
  "id": id,
1118
  "name": name,
1119
  "readable": byte,
@@ -1125,140 +1137,111 @@ def mediafire(link: Union[str, None] = None):
1125
  return {'status': 'false', 'message': 'Invalid Link'}
1126
 
1127
  @app.get("/ryuzaki/gdrive")
1128
- def gdrive(link: Union[str, None] = None):
1129
- try:
1130
- down = link.split('/', 6)
1131
- url = f'https://drive.google.com/uc?export=download&id={down[5]}'
1132
- session = requests.Session()
1133
-
1134
- response = session.get(url, stream=True)
1135
- headers = response.headers
1136
- content_disp = headers.get('content-disposition')
1137
- filename = None
1138
- if content_disp:
1139
- match = re.search(r'filename="(.+)"', content_disp)
1140
- if match:
1141
- filename = match.group(1)
1142
-
1143
- content_length = headers.get('content-length')
1144
- last_modified = headers.get('last-modified')
1145
- content_type = headers.get('content-type')
1146
-
1147
- return {
1148
- "status": "true",
1149
- "data": {
1150
- "file": {
1151
- "url": {
1152
- 'directDownload': url,
1153
- "original": link,
1154
- },
1155
- "metadata": {
1156
- "id":
1157
- down[5],
1158
- "name":
1159
- filename if filename else 'No filename provided by the server.',
1160
- "size": {
1161
- "readable":
1162
- f'{round(int(content_length) / (1024 * 1024), 2)} MB' if
1163
- content_length else 'No content length provided by the server.',
1164
- "type":
1165
- content_type
1166
- if content_type else 'No content type provided by the server.'
1167
- },
1168
- "DateAndTime":
1169
- last_modified if last_modified else
1170
- 'No last modified date provided by the server.',
1171
- }
1172
- }
1173
- }
1174
- }
1175
- except:
1176
- return "{'status': 'false', 'message': 'Invalid Link'}"
1177
 
1178
  @app.get("/ryuzaki/anonfiles")
1179
- def anonfiles(link: Union[str, None] = None):
1180
- try:
1181
- r = requests.get(link)
1182
- soup = BeautifulSoup(r.content, "html.parser")
1183
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1184
- a = str(a_href)
1185
- id = link.split('/', 4)[3]
1186
- jsondata = requests.get(
1187
- f'https://api.anonfiles.com/v2/file/{id}/info').json()
1188
- jsondata['data']['file']['url']['directDownload'] = a
1189
- del jsondata['data']['file']['url']['full']
1190
-
1191
- return jsondata
1192
- except:
1193
- return "{'status': 'false', 'message': 'Invalid Link'}"
1194
 
1195
  @app.get("/ryuzaki/filechan")
1196
- def filechan(link: Union[str, None] = None):
1197
- try:
1198
- r = requests.get(link)
1199
- soup = BeautifulSoup(r.content, "html.parser")
1200
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1201
- a = str(a_href)
1202
- id = link.split('/', 4)[3]
1203
- jsondata = requests.get(
1204
- f'https://api.filechan.org/v2/file/{id}/info').json()
1205
- jsondata['data']['file']['url']['directDownload'] = a
1206
- del jsondata['data']['file']['url']['full']
1207
-
1208
- return jsondata
1209
- except:
1210
- return "{'status': 'false', 'message': 'Invalid Link'}"
1211
 
1212
  @app.get("/ryuzaki/letsupload")
1213
- def letsupload(link: Union[str, None] = None):
1214
- try:
1215
- r = requests.get(link)
1216
- soup = BeautifulSoup(r.content, "html.parser")
1217
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1218
- a = str(a_href)
1219
- id = link.split('/', 4)[3]
1220
- jsondata = requests.get(
1221
- f'https://api.letsupload.cc/v2/file/{id}/info').json()
1222
- jsondata['data']['file']['url']['directDownload'] = a
1223
- del jsondata['data']['file']['url']['full']
1224
-
1225
- return jsondata
1226
- except:
1227
- return "{'status': 'false', 'message': 'Invalid Link'}"
1228
 
1229
  @app.get("/ryuzaki/megaupload")
1230
- def megaupload(link: Union[str, None] = None):
1231
- try:
1232
- r = requests.get(link)
1233
- soup = BeautifulSoup(r.content, "html.parser")
1234
- a_href = soup.find("a", {"id": "download-url"}).get("href")
1235
- a = str(a_href)
1236
- id = link.split('/', 4)[3]
1237
- jsondata = requests.get(
1238
- f'https://api.megaupload.nz/v2/file/{id}/info').json()
1239
- jsondata['data']['file']['url']['directDownload'] = a
1240
- del jsondata['data']['file']['url']['full']
1241
-
1242
- return jsondata
1243
- except:
1244
- return "{'status': 'false', 'message': 'Invalid Link'}"
1245
 
1246
  @app.get("/ryuzaki/myfile")
1247
- def myfile(link: Union[str, None] = None):
1248
- try:
1249
- r = requests.get(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(
1255
- f'https://api.myfile.is/v2/file/{id}/info').json()
1256
- jsondata['data']['file']['url']['directDownload'] = a
1257
- del jsondata['data']['file']['url']['full']
1258
-
1259
- return jsondata
1260
- except:
1261
- return "{'status': 'false', 'message': 'Invalid Link'}"
1262
 
1263
  description = """
1264
  - Ryuzaki Library: [Library Here](https://github.com/TeamKillerX/RyuzakiLib)
 
86
  SOURCE_WAIFU_URL = os.environ["SOURCE_WAIFU_URL"]
87
  SOURCE_TIKTOK_WTF_URL = os.environ["SOURCE_TIKTOK_WTF_URL"]
88
  SOURCE_TIKTOK_TECH_URL = os.environ["SOURCE_TIKTOK_TECH_URL"]
 
89
  SOURCE_WHAT_GAY_URL = os.environ["SOURCE_WHAT_GAY_URL"]
90
  SOURCE_ASSISTANT_GOOGLE_AI = os.environ["SOURCE_ASSISTANT_GOOGLE_AI"]
91
  SOURCE_MONITOR_URL = os.environ["SOURCE_MONITOR_URL"]
 
240
  class SibylSystem(BaseModel):
241
  user_id: int
242
 
243
+ class SibylSystemResponse(BaseModel):
244
+ sibyl_name: str
245
+ reason: str
246
+ is_banned: bool
247
+ date_joined: str
248
+ sibyl_user_id: int
249
+
250
  class GoogleReverse(BaseModel):
251
  engine: str="google_reverse_image"
252
  image_url: str
 
320
  class GetMonitorLogs(BaseModel):
321
  logs: int
322
 
323
+ class DownloadLink(BaseModel):
324
+ link: str
325
+
326
  @app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
327
  def profile_clone(
328
  item: ProfileClone,
 
453
  except Exception as e:
454
  return ErrorStatus(status="false", message=f"Internal server error: {str(e)}")
455
 
456
+ @app.get("/ryuzaki/sibyl", response_model=SibylSystemResponse, responses={422: {"model": SibylSystemResponse}})
457
  def sibyl_system(
458
  item: SibylSystem,
459
  api_key: None = Depends(validate_api_key)
460
  ):
461
  sibyl_name, reason, is_banned, date_joined, sibyl_user_id = get_sibyl_system_banned(item.user_id)
462
  if sibyl_name and reason and is_banned and date_joined and sibyl_user_id:
463
+ return SibylSystemResponse(
464
+ sibyl_name=sibyl_name,
465
+ reason=reason,
466
+ is_banned=is_banned,
467
+ date_joined=date_joined,
468
+ sibyl_user_id=sibyl_user_id
 
 
 
469
  )
470
  else:
471
+ return SibylSystemResponse(
472
+ sibyl_name="",
473
+ reason="",
474
+ is_banned=False,
475
+ date_joined="",
476
+ sibyl_user_id=0
477
+ )
478
 
479
  @app.get("/ryuzaki/ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
480
  def ryuzaki_ai(
 
1098
  return {"status": "false", "message": "Invalid Link"}
1099
 
1100
  @app.get("/ryuzaki/mediafire")
1101
+ def mediafire(item: DownloadLink):
1102
  try:
1103
+ down_link = str(item.link)
1104
  mid = down_link.split('/', 5)
1105
  if mid[3] == "view":
1106
  mid[3] = "file"
 
1125
  status="True",
1126
  randydev={
1127
  "directDownload": a,
1128
+ "original": item.link,
1129
  "id": id,
1130
  "name": name,
1131
  "readable": byte,
 
1137
  return {'status': 'false', 'message': 'Invalid Link'}
1138
 
1139
  @app.get("/ryuzaki/gdrive")
1140
+ def gdrive(item: DownloadLink):
1141
+ try:
1142
+ down = link.split('/', 6)
1143
+ url = f'https://drive.google.com/uc?export=download&id={down[5]}'
1144
+ session = requests.Session()
1145
+ response = session.get(url, stream=True)
1146
+ headers = response.headers
1147
+ content_disp = headers.get('content-disposition')
1148
+ filename = None
1149
+ if content_disp:
1150
+ match = re.search(r'filename="(.+)"', content_disp)
1151
+ if match:
1152
+ filename = match.group(1)
1153
+ content_length = headers.get('content-length')
1154
+ last_modified = headers.get('last-modified')
1155
+ content_type = headers.get('content-type')
1156
+ return SuccessResponse(
1157
+ status="True",
1158
+ randydev={
1159
+ "directDownload": url,
1160
+ "original": item.link,
1161
+ "id": down[5],
1162
+ "name": filename if filename else "No filename provided by the server.",
1163
+ "readable": f"{round(int(content_length) / (1024 * 1024), 2)} MB" if content_length else "No content length provided by the server.",
1164
+ "type": content_type if content_type else "No content type provided by the server.",
1165
+ "DateAndTime": last_modified if last_modified else "No last modified date provided by the server."
1166
+ }
1167
+ )
1168
+ except:
1169
+ return {'status': 'false', 'message': 'Invalid Link'}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1170
 
1171
  @app.get("/ryuzaki/anonfiles")
1172
+ def anonfiles(item: DownloadLink):
1173
+ try:
1174
+ r = requests.get(item.link)
1175
+ soup = BeautifulSoup(r.content, "html.parser")
1176
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
1177
+ a = str(a_href)
1178
+ id = link.split('/', 4)[3]
1179
+ jsondata = requests.get(f'https://api.anonfiles.com/v2/file/{id}/info').json()
1180
+ jsondata['data']['file']['url']['directDownload'] = a
1181
+ del jsondata['data']['file']['url']['full']
1182
+ return jsondata
1183
+ except:
1184
+ return "{'status': 'false', 'message': 'Invalid Link'}"
 
 
1185
 
1186
  @app.get("/ryuzaki/filechan")
1187
+ def filechan(item: DownloadLink):
1188
+ try:
1189
+ r = requests.get(item.link)
1190
+ soup = BeautifulSoup(r.content, "html.parser")
1191
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
1192
+ a = str(a_href)
1193
+ id = link.split('/', 4)[3]
1194
+ jsondata = requests.get(f'https://api.filechan.org/v2/file/{id}/info').json()
1195
+ jsondata['data']['file']['url']['directDownload'] = a
1196
+ del jsondata['data']['file']['url']['full']
1197
+ return jsondata
1198
+ except:
1199
+ return {'status': 'false', 'message': 'Invalid Link'}
 
 
1200
 
1201
  @app.get("/ryuzaki/letsupload")
1202
+ def letsupload(item: DownloadLink):
1203
+ try:
1204
+ r = requests.get(item.link)
1205
+ soup = BeautifulSoup(r.content, "html.parser")
1206
+ a_href = soup.find("a", {"id": "download-url"}).get("href")
1207
+ a = str(a_href)
1208
+ id = link.split('/', 4)[3]
1209
+ jsondata = requests.get(f'https://api.letsupload.cc/v2/file/{id}/info').json()
1210
+ jsondata['data']['file']['url']['directDownload'] = a
1211
+ del jsondata['data']['file']['url']['full']
1212
+ return jsondata
1213
+ except:
1214
+ return {'status': 'false', 'message': 'Invalid Link'}
 
 
1215
 
1216
  @app.get("/ryuzaki/megaupload")
1217
+ def megaupload(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.megaupload.nz/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/myfile")
1232
+ def myfile(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.myfile.is/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
  description = """
1247
  - Ryuzaki Library: [Library Here](https://github.com/TeamKillerX/RyuzakiLib)