randydev commited on
Commit
38374b1
1 Parent(s): ee74014

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +72 -67
main.py CHANGED
@@ -283,6 +283,37 @@ class MakeRayso(BaseModel):
283
  auto_translate: Optional[bool] = None
284
  ryuzaki_dark: bool=True
285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  @app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
287
  def profile_clone(
288
  item: ProfileClone,
@@ -456,7 +487,7 @@ def ryuzaki_ai(
456
  except Exception:
457
  return {"status": "false", "message": "Internal server error"}
458
 
459
- @app.get("/ryuzaki/unsplash", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
460
  async def get_image_unsplash(item: GetImageUnsplash):
461
  url = SOURCE_UNSPLASH_URL
462
  image_url = f"{url}/?{item.query}/{item.size}"
@@ -695,16 +726,14 @@ def v1beta2_google_ai(
695
  except:
696
  return {"status": "false", "message": "Error response."}
697
 
698
- @app.post("/ryuzaki/new-monitor")
699
  def new_monitor(
700
- type: int=1,
701
- url: str=None,
702
- friendly_name: str=None,
703
  api_key: None = Depends(validate_api_key)
704
  ):
705
- url = SOURCE_MONITOR_URL
706
  token = MONITOR_API_KEYS
707
- api_url = f"{url}/newMonitor"
708
  try:
709
  headers = {
710
  "content-type": "application/x-www-form-urlencoded",
@@ -713,9 +742,9 @@ def new_monitor(
713
  payload = {
714
  "api_key": token,
715
  "format": "json",
716
- "type": type,
717
- "url": url,
718
- "friendly_name": friendly_name
719
  }
720
  response = requests.post(api_url, data=payload, headers=headers)
721
  response_str = response.json()
@@ -733,9 +762,9 @@ def new_monitor(
733
  except:
734
  return {"status": "false", "message": "Error response."}
735
 
736
- @app.post("/ryuzaki/get-monitors")
737
  def getMonitors(
738
- logs: int=1,
739
  api_key: None = Depends(validate_api_key)
740
  ):
741
  url = SOURCE_MONITOR_URL
@@ -749,7 +778,7 @@ def getMonitors(
749
  payload = {
750
  "api_key": token,
751
  "format": "json",
752
- "logs": logs
753
  }
754
  response = requests.post(api_url, data=payload, headers=headers)
755
  response_str = response.json()
@@ -796,10 +825,10 @@ async def get_data(username):
796
  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!`"
797
  return [base_msg, "https://telegra.ph//file/32f69c18190666ea96553.jpg"]
798
 
799
- @app.get("/ryuzaki/github")
800
- async def github(username: str=None):
801
  try:
802
- details = await get_data(username)
803
  return {
804
  "status": "true",
805
  "randydev":{
@@ -810,16 +839,10 @@ async def github(username: str=None):
810
  except:
811
  return {"status": "false", "message": "Error response."}
812
 
813
- @app.get("/ryuzaki/webshot")
814
- def webshot(
815
- url: str=None,
816
- quality: str="1920x1080",
817
- type_mine: str="JPEG",
818
- pixels: str="1024",
819
- cast: str="Z100"
820
- ):
821
  try:
822
- required_url = f"https://mini.s-shot.ru/{quality}/{type_mine}/{pixels}/{cast}/?{url}"
823
  return {
824
  "status": "true",
825
  "randydev":{
@@ -829,19 +852,14 @@ def webshot(
829
  except:
830
  return {"status": "false", "message": "Error response."}
831
 
832
- @app.get("/ryuzaki/chatbot")
833
- def chatbot(
834
- query: str=None,
835
- user_id: int=None,
836
- bot_name: str=None,
837
- bot_username: str=None
838
- ):
839
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLmRldi9jaGF0Ym90").decode("utf-8")
840
  params = {
841
- "query": query,
842
- "user_id": user_id,
843
- "bot_name": bot_name,
844
- "bot_master": bot_username
845
  }
846
  x = requests.get(f"{api_url}", params=params)
847
  if x.status_code != 200:
@@ -858,7 +876,7 @@ def chatbot(
858
  except:
859
  return {"status": "false", "message": "Error response."}
860
 
861
- @app.get("/ryuzaki/llama")
862
  def get_llama(item: ChatgptCustom):
863
  api_url = SOURCE_WHAT_GAY_URL
864
  params = {"query": item.query}
@@ -877,7 +895,7 @@ def get_llama(item: ChatgptCustom):
877
  except:
878
  return {"status": "false", "message": "Error response."}
879
 
880
- @app.get("/ryuzaki/waifu")
881
  def waifu_pics(item: WaifuPics):
882
  waifu_api = f"{SOURCE_WAIFU_URL}/{item.types}"
883
  waifu_param = f"{waifu_api}/{item.category}"
@@ -909,7 +927,7 @@ def waifu_pics(item: WaifuPics):
909
  else:
910
  return {"status": "false", "message": "Error response."}
911
 
912
- @app.get("/ryuzaki/rayso")
913
  def make_rayso(item: MakeRayso):
914
  trans = SyncTranslator()
915
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLm1lL3JheXNv").decode("utf-8")
@@ -1013,9 +1031,9 @@ def whois_ip_address(ip_address: str=None):
1013
  else:
1014
  return {"status": "false", "message": "Invalid ip address"}
1015
 
1016
- @app.get("/ryuzaki/tiktok_douyin")
1017
- def tiktok_douyin(tiktok_url: str=None):
1018
- response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={tiktok_url}")
1019
  if response.status_code != 200:
1020
  return "Internal server error"
1021
  try:
@@ -1037,10 +1055,10 @@ def tiktok_douyin(tiktok_url: str=None):
1037
  except:
1038
  return {"status": "false", "message": "Error request"}
1039
 
1040
- @app.get("/ryuzaki/tiktok")
1041
- def tiktok_downloader(tiktok_url: Union[str, None] = None, only_video: bool=None):
1042
  api_devs = SOURCE_TIKTOK_TECH_URL
1043
- parameter = f"tiktok?url={tiktok_url}"
1044
  api_url = f"{api_devs}/{parameter}"
1045
  response = requests.get(api_url)
1046
 
@@ -1049,7 +1067,7 @@ def tiktok_downloader(tiktok_url: Union[str, None] = None, only_video: bool=None
1049
  try:
1050
  results = response.json()
1051
  caption = results.get("result", {}).get("desc", "")
1052
- if only_video:
1053
  video_url = results.get("result", {}).get("withoutWaterMarkVideo", "")
1054
  if video_url:
1055
  return {
@@ -1075,7 +1093,6 @@ def mediafire(link: Union[str, None] = None):
1075
  if mid[3] == "view":
1076
  mid[3] = "file"
1077
  down_link = '/'.join(mid)
1078
- print(down_link)
1079
  r = requests.get(down_link)
1080
  soup = BeautifulSoup(r.content, "html.parser")
1081
  a_href = soup.find("a", {"class": "input popsok"}).get("href")
@@ -1092,29 +1109,18 @@ def mediafire(link: Union[str, None] = None):
1092
  date = dat[0]
1093
  byte = down.split("(", 1)[1].split(")", 1)[0]
1094
  name = a_name.replace(" ", "").strip()
1095
- return {
1096
- "status": "true",
1097
- "data": {
1098
- "file": {
1099
- "url": {
1100
- 'directDownload': a,
1101
  "original": link,
1102
- },
1103
- "metadata": {
1104
  "id": id,
1105
  "name": name,
1106
- "size": {
1107
- "readable": byte
1108
- },
1109
- "DateAndTime": {
1110
- "time": time,
1111
- "date": date
1112
- }
1113
- }
1114
  }
1115
- }
1116
- }
1117
-
1118
  except:
1119
  return "{'status': 'false', 'message': 'Invalid Link'}"
1120
 
@@ -1167,7 +1173,6 @@ def gdrive(link: Union[str, None] = None):
1167
  }
1168
  }
1169
  }
1170
-
1171
  except:
1172
  return "{'status': 'false', 'message': 'Invalid Link'}"
1173
 
 
283
  auto_translate: Optional[bool] = None
284
  ryuzaki_dark: bool=True
285
 
286
+ class Webshot(BaseModel):
287
+ url: str
288
+ quality: str="1920x1080"
289
+ type_mine: str="JPEG"
290
+ pixels: str="1024"
291
+ cast: str="Z100"
292
+
293
+ class GithubUsernames(BaseModel):
294
+ username: str
295
+
296
+ class ChatBots(BaseModel):
297
+ query: str
298
+ user_id: Optional[int] = None
299
+ bot_name: Optional[str] = None
300
+ bot_username: Optional[str] = None
301
+
302
+ class NewMonitor(BaseModel):
303
+ type: int=1
304
+ url: str
305
+ friendly_name: str
306
+
307
+ class TiktokBeta(BaseModel):
308
+ tiktok_url: str
309
+ only_video: Optional[bool] = None
310
+
311
+ class TiktokDownloader(BaseModel):
312
+ tiktok_url: str
313
+
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,
 
487
  except Exception:
488
  return {"status": "false", "message": "Internal server error"}
489
 
490
+ @app.get("/ryuzaki/unsplash")
491
  async def get_image_unsplash(item: GetImageUnsplash):
492
  url = SOURCE_UNSPLASH_URL
493
  image_url = f"{url}/?{item.query}/{item.size}"
 
726
  except:
727
  return {"status": "false", "message": "Error response."}
728
 
729
+ @app.post("/ryuzaki/new-monitor", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
730
  def new_monitor(
731
+ item: NewMonitor,
 
 
732
  api_key: None = Depends(validate_api_key)
733
  ):
734
+ urls = SOURCE_MONITOR_URL
735
  token = MONITOR_API_KEYS
736
+ api_url = f"{urls}/newMonitor"
737
  try:
738
  headers = {
739
  "content-type": "application/x-www-form-urlencoded",
 
742
  payload = {
743
  "api_key": token,
744
  "format": "json",
745
+ "type": item.type,
746
+ "url": item.url,
747
+ "friendly_name": item.friendly_name
748
  }
749
  response = requests.post(api_url, data=payload, headers=headers)
750
  response_str = response.json()
 
762
  except:
763
  return {"status": "false", "message": "Error response."}
764
 
765
+ @app.post("/ryuzaki/get-monitors", response_model=SuccessResponse, responses={422: {"model": ErrorResponse}})
766
  def getMonitors(
767
+ item: GetMonitorLogs,
768
  api_key: None = Depends(validate_api_key)
769
  ):
770
  url = SOURCE_MONITOR_URL
 
778
  payload = {
779
  "api_key": token,
780
  "format": "json",
781
+ "logs": item.logs
782
  }
783
  response = requests.post(api_url, data=payload, headers=headers)
784
  response_str = response.json()
 
825
  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!`"
826
  return [base_msg, "https://telegra.ph//file/32f69c18190666ea96553.jpg"]
827
 
828
+ @app.get("/ryuzaki/github", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
829
+ async def github(item: GithubUsernames):
830
  try:
831
+ details = await get_data(item.username)
832
  return {
833
  "status": "true",
834
  "randydev":{
 
839
  except:
840
  return {"status": "false", "message": "Error response."}
841
 
842
+ @app.get("/ryuzaki/webshot", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
843
+ def webshot(item: Webshot):
 
 
 
 
 
 
844
  try:
845
+ required_url = f"https://mini.s-shot.ru/{item.quality}/{item.type_mine}/{item.pixels}/{item.cast}/?{item.url}"
846
  return {
847
  "status": "true",
848
  "randydev":{
 
852
  except:
853
  return {"status": "false", "message": "Error response."}
854
 
855
+ @app.get("/ryuzaki/chatbot", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
856
+ def chatbot(item: ChatBots):
 
 
 
 
 
857
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLmRldi9jaGF0Ym90").decode("utf-8")
858
  params = {
859
+ "query": item.query,
860
+ "user_id": item.user_id,
861
+ "bot_name": item.bot_name,
862
+ "bot_master": item.bot_username
863
  }
864
  x = requests.get(f"{api_url}", params=params)
865
  if x.status_code != 200:
 
876
  except:
877
  return {"status": "false", "message": "Error response."}
878
 
879
+ @app.get("/ryuzaki/llama", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
880
  def get_llama(item: ChatgptCustom):
881
  api_url = SOURCE_WHAT_GAY_URL
882
  params = {"query": item.query}
 
895
  except:
896
  return {"status": "false", "message": "Error response."}
897
 
898
+ @app.get("/ryuzaki/waifu", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
899
  def waifu_pics(item: WaifuPics):
900
  waifu_api = f"{SOURCE_WAIFU_URL}/{item.types}"
901
  waifu_param = f"{waifu_api}/{item.category}"
 
927
  else:
928
  return {"status": "false", "message": "Error response."}
929
 
930
+ @app.get("/ryuzaki/rayso", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
931
  def make_rayso(item: MakeRayso):
932
  trans = SyncTranslator()
933
  api_url = b64decode("aHR0cHM6Ly9hcGkuc2Fmb25lLm1lL3JheXNv").decode("utf-8")
 
1031
  else:
1032
  return {"status": "false", "message": "Invalid ip address"}
1033
 
1034
+ @app.get("/ryuzaki/tiktok_douyin", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1035
+ def tiktok_douyin(item: TiktokDownloader):
1036
+ response = requests.get(f"{SOURCE_TIKTOK_WTF_URL}={item.tiktok_url}")
1037
  if response.status_code != 200:
1038
  return "Internal server error"
1039
  try:
 
1055
  except:
1056
  return {"status": "false", "message": "Error request"}
1057
 
1058
+ @app.get("/ryuzaki/tiktok", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
1059
+ def tiktok_downloader(item: TiktokBeta)
1060
  api_devs = SOURCE_TIKTOK_TECH_URL
1061
+ parameter = f"tiktok?url={item.tiktok_url}"
1062
  api_url = f"{api_devs}/{parameter}"
1063
  response = requests.get(api_url)
1064
 
 
1067
  try:
1068
  results = response.json()
1069
  caption = results.get("result", {}).get("desc", "")
1070
+ if item.only_video:
1071
  video_url = results.get("result", {}).get("withoutWaterMarkVideo", "")
1072
  if video_url:
1073
  return {
 
1093
  if mid[3] == "view":
1094
  mid[3] = "file"
1095
  down_link = '/'.join(mid)
 
1096
  r = requests.get(down_link)
1097
  soup = BeautifulSoup(r.content, "html.parser")
1098
  a_href = soup.find("a", {"class": "input popsok"}).get("href")
 
1109
  date = dat[0]
1110
  byte = down.split("(", 1)[1].split(")", 1)[0]
1111
  name = a_name.replace(" ", "").strip()
1112
+ return SuccessResponse(
1113
+ status="True",
1114
+ randydev={
1115
+ "directDownload": a,
 
 
1116
  "original": link,
 
 
1117
  "id": id,
1118
  "name": name,
1119
+ "readable": byte,
1120
+ "time": byte,
1121
+ "date": date
 
 
 
 
 
1122
  }
1123
+ )
 
 
1124
  except:
1125
  return "{'status': 'false', 'message': 'Invalid Link'}"
1126
 
 
1173
  }
1174
  }
1175
  }
 
1176
  except:
1177
  return "{'status': 'false', 'message': 'Invalid Link'}"
1178