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

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +37 -38
main.py CHANGED
@@ -1056,7 +1056,7 @@ def tiktok_douyin(item: TiktokDownloader):
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}"
@@ -1087,43 +1087,42 @@ def tiktok_downloader(item: TiktokBeta)
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"
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")
1099
- a = str(a_href)
1100
- id = link.split('/', 5)[4]
1101
- a_byte = soup.find("a", {"class": "input popsok"}).get_text()
1102
- a_name = soup.find("div", {"class": "dl-btn-label"}).get_text()
1103
- details = soup.find("ul", {"class": "details"})
1104
- li_items = details.find_all('li')[1]
1105
- some = li_items.find_all("span")[0].get_text().split()
1106
- dat = list(some)
1107
- down = a_byte.replace(" ", "").strip()
1108
- time = dat[1]
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
-
1127
 
1128
  @app.get("/ryuzaki/gdrive")
1129
  def gdrive(link: Union[str, None] = None):
 
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}"
 
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"
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")
1099
+ a = str(a_href)
1100
+ id = link.split('/', 5)[4]
1101
+ a_byte = soup.find("a", {"class": "input popsok"}).get_text()
1102
+ a_name = soup.find("div", {"class": "dl-btn-label"}).get_text()
1103
+ details = soup.find("ul", {"class": "details"})
1104
+ li_items = details.find_all('li')[1]
1105
+ some = li_items.find_all("span")[0].get_text().split()
1106
+ dat = list(some)
1107
+ down = a_byte.replace(" ", "").strip()
1108
+ time = dat[1]
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
 
1127
  @app.get("/ryuzaki/gdrive")
1128
  def gdrive(link: Union[str, None] = None):