randydev commited on
Commit
bac9516
1 Parent(s): 5dfe35c

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +31 -20
main.py CHANGED
@@ -725,40 +725,51 @@ async def tiktokdl_(link: str):
725
  )
726
 
727
  @app.get("/akeno/xnxxsearch", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
728
- async def xnxx_search(query: str):
 
 
 
 
729
  try:
 
 
 
 
 
 
730
  search = xnxx_client().search(
731
  query,
732
  length=search_filters.Length.X_0_10min,
733
  upload_time=search_filters.UploadTime.year,
734
- searching_quality=search_filters.SearchingQuality.X_1080p_plus,
735
  limit=1
736
  )
737
  response = search.videos
 
738
  for x in response:
739
- return SuccessResponse(
740
- status="True",
741
- randydev={
742
- "results": [
743
- {
744
- "link": x.content_url,
745
- "title": x.title,
746
- "author": x.author,
747
- "length": x.highest_quality,
748
- "highest_quality": x.highest_quality,
749
- "publish_date": x.publish_date,
750
- "views": x.views,
751
- "thumb": x.thumbnail_url
752
- }
753
- ]
754
- }
755
- )
756
  except Exception as e:
757
  return SuccessResponse(
758
  status="False",
759
- randydev={"error": f"Error fucking: {e}"}
760
  )
761
 
 
762
  @app.get("/akeno/xnxx-dl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
763
  async def xnxx_download(link: str):
764
  try:
 
725
  )
726
 
727
  @app.get("/akeno/xnxxsearch", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
728
+ async def xnxx_search(query: str, quality: str):
729
+ data_dict = {
730
+ "720p": search_filters.SearchingQuality.X_720p,
731
+ "1080p": search_filters.SearchingQuality.X_1080p_plus
732
+ }
733
  try:
734
+ if quality not in data_dict:
735
+ return SuccessResponse(
736
+ status="False",
737
+ randydev={"error": "Invalid quality"}
738
+ )
739
+ SearchingQuality = data_dict[quality]
740
  search = xnxx_client().search(
741
  query,
742
  length=search_filters.Length.X_0_10min,
743
  upload_time=search_filters.UploadTime.year,
744
+ searching_quality=SearchingQuality,
745
  limit=1
746
  )
747
  response = search.videos
748
+ results = []
749
  for x in response:
750
+ results.append({
751
+ "link": x.content_url,
752
+ "title": x.title,
753
+ "author": x.author,
754
+ "length": x.length,
755
+ "highest_quality": x.highest_quality,
756
+ "publish_date": x.publish_date,
757
+ "views": x.views,
758
+ "thumb": x.thumb
759
+ })
760
+ return SuccessResponse(
761
+ status="True",
762
+ randydev={
763
+ "results": results
764
+ }
765
+ )
 
766
  except Exception as e:
767
  return SuccessResponse(
768
  status="False",
769
+ randydev={"error": f"Error: {e}"}
770
  )
771
 
772
+
773
  @app.get("/akeno/xnxx-dl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
774
  async def xnxx_download(link: str):
775
  try: