File size: 10,882 Bytes
2f1d976 58c9745 2f1d976 950d6aa b17c4fd e96c447 950d6aa 4cc679b e96c447 950d6aa 2f1d976 950d6aa e96c447 950d6aa 00c4bbe 950d6aa 00c4bbe 950d6aa e96c447 950d6aa e96c447 950d6aa 4cc679b 950d6aa 4cc679b 950d6aa 00c4bbe 950d6aa 00c4bbe 950d6aa 2f1d976 e96c447 3ee9500 e96c447 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
import requests
import random
from bs4 import BeautifulSoup
from fastapi import FastAPI, HTTPException, Depends
from itertools import islice
from typing import Optional
from models import SuccessResponse, ErrorResponse, API_VERSION
from fastapi.middleware.cors import CORSMiddleware
from xnxx_api import search_filters
from xnxx_api import Client as xnxx_client
from xvideos_api import Client as xvid_client
from xvideos_api import sorting
# ----- FastAPI Setup -----
app = FastAPI(title="Awesome API", version=API_VERSION)
# CORS Configuration
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
# ----- Helper Functions -----
async def get_api_version():
return API_VERSION
async def HentaiAnime():
try:
page = random.randint(1, 1153)
response = requests.get(f'https://sfmcompile.club/page/{page}')
response.raise_for_status()
soup = BeautifulSoup(response.text, 'html.parser')
hasil = []
articles = soup.select('#primary > div > div > ul > li > article')
for article in articles:
title = article.select_one('header > h2').text
link = article.select_one('header > h2 > a')['href']
category = article.select_one('header > div.entry-before-title > span > span').text.replace('in ', '')
share_count = article.select_one('header > div.entry-after-title > p > span.entry-shares').text
views_count = article.select_one('header > div.entry-after-title > p > span.entry-views').text
type_ = article.select_one('source')['type'] if article.select_one('source') else 'image/jpeg'
video_1 = article.select_one('source')['src'] if article.select_one('source') else article.select_one('img')['data-src']
video_2 = article.select_one('video > a')['href'] if article.select_one('video > a') else ''
hasil.append({
"title": title,
"link": link,
"category": category,
"share_count": share_count,
"views_count": views_count,
"type": type_,
"video_1": video_1,
"video_2": video_2
})
if not hasil:
return {'developer': '@neomatrix90', 'error': 'no result found'}
return hasil
except Exception:
return None
# ----- API Endpoints -----
@app.get("/", response_model=SuccessResponse)
async def root(version: str = Depends(get_api_version)):
"""Service health check endpoint"""
return SuccessResponse(data={
"message": "Service operational",
})
@app.get("/protected", responses={
200: {"model": SuccessResponse},
403: {"model": ErrorResponse}
})
async def protected_route(secret_key: Optional[str] = None):
"""Endpoint demonstrating error responses"""
if not secret_key or secret_key != "supersecret123":
return ErrorResponse(
error_code=403,
message="Invalid or missing secret key"
)
return SuccessResponse(data={
"secret_data": "π You've unlocked premium content!",
"access_level": "VIP"
})
@app.get("/prono/xnxxsearch", response_model=SuccessResponse)
async def xnxx_search(
query: str,
quality: Optional[str] = None,
upload_time: Optional[str] = None,
length: Optional[str] = None,
mode: Optional[str] = None,
# page: Optional[int] = None,
results: Optional[int] = 20
):
data_dict = {
"quality": {
"720p": search_filters.SearchingQuality.X_720p,
"1080p": search_filters.SearchingQuality.X_1080p_plus
},
"upload_time": {
"year": search_filters.UploadTime.year,
"month": search_filters.UploadTime.month
},
"length": {
"0-10min": search_filters.Length.X_0_10min,
"10min+": search_filters.Length.X_10min_plus,
"10-20min": search_filters.Length.X_10_20min,
"20min+": search_filters.Length.X_20min_plus
},
"mode": {
"default": search_filters.Mode.default,
"hits": search_filters.Mode.hits,
"random": search_filters.Mode.random
}
}
try:
# Prepare search parameters
search_kwargs = {
"query": query
}
if length is not None:
search_kwargs["length"] = data_dict["length"][length]
if quality is not None:
search_kwargs["searching_quality"] = data_dict["quality"][quality]
if upload_time is not None:
search_kwargs["upload_time"] = data_dict["upload_time"][upload_time]
if mode is not None:
search_kwargs["mode"] = data_dict["mode"][mode]
# if page is not None:
# search_kwargs["limit"] = page
# Perform the search with only the provided parameters
c = xnxx_client()
search = c.search(**search_kwargs)
# response = search.videos
# if results is not None:
# response = islice(res, results)
results_list = []
for x in islice(search.videos, results):
results_list.append({
"title": x.title,
"url": x.url,
"author": x.author,
"length": x.length,
# "highest_quality": x.highest_quality,
"publish_date": x.publish_date,
# "views": x.views,
"thumb": x.thumbnail_url[0] if isinstance(x.thumbnail_url, list) and len(x.thumbnail_url) > 0 else None
})
return SuccessResponse(
data={
"results": results_list
}
)
except Exception as e:
return SuccessResponse(
status="False",
data={"error": f"Error: {e}"}
)
@app.get("/prono/hentai", response_model=SuccessResponse)
async def hentai_():
try:
response = await HentaiAnime()
return SuccessResponse(
status="True",
data={"results": response}
)
except:
return SuccessResponse(
status="False",
data={"error": "Error fucking"}
)
@app.get("/prono/xnxx-dl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
async def xnxx_download(link: str):
try:
x = xnxx_client()
response = x.get_video(link)
return SuccessResponse(
data={
"results": {
"title": response.title,
"author": response.author,
"length": f"{response.length} min",
"highest_quality": response.highest_quality,
"publish_date": response.publish_date,
"views": response.views,
"link": response.content_url,
"thumb": response.thumbnail_url[0] if isinstance(response.thumbnail_url, list) and len(response.thumbnail_url) > 0 else None
}
}
)
except Exception as e:
return SuccessResponse(
status="False",
randydev={"error": f"Error fucking: {e}"}
)
@app.get("/prono/xvidsearch", response_model=SuccessResponse)
async def xvid_search(
query: str,
quality: Optional[str] = None,
upload_time: Optional[str] = None,
length: Optional[str] = None,
mode: Optional[str] = None,
# page: Optional[int] = None,
results: Optional[int] = 20
):
data_dict = {
"quality": {
"720p": sorting.SortQuality.Sort_720p,
"1080p": sorting.SortQuality.Sort_1080_plus
},
"upload_time": {
"3months": sorting.SortDate.Sort_last_3_months,
"6months": sorting.SortDate.Sort_last_6_months
},
"length": {
"0-10min": sorting.SortVideoTime.Sort_middle,
"10min+": sorting.SortVideoTime.Sort_long,
"10-20min": sorting.SortVideoTime.Sort_long_10_20min,
"20min+": sorting.SortVideoTime.Sort_really_long
},
"mode": {
"rating": sorting.Sort.Sort_rating,
"views": sorting.Sort.Sort_views,
"random": sorting.Sort.Sort_random,
"relevance": sorting.Sort.Sort_relevance
}
}
try:
# Prepare search parameters
search_kwargs = {
"query": query
}
if length is not None:
search_kwargs["sorting_time"] = data_dict["length"][length]
if quality is not None:
search_kwargs["sort_quality"] = data_dict["quality"][quality]
if upload_time is not None:
search_kwargs["sorting_time"] = data_dict["upload_time"][upload_time]
if mode is not None:
search_kwargs["sorting_sort"] = data_dict["mode"][mode]
# Perform the search with only the provided parameters
c = xvid_client()
search = c.search(**search_kwargs)
# response = search.videos
# if results is not None:
# response = islice(res, results)
results_list = []
for x in islice(search, results):
results_list.append({
"title": x.title,
"url": x.url,
"author": x.author,
"length": x.length,
"publish_date": x.publish_date,
"views": x.views,
"thumb": x.thumbnail_url
})
return SuccessResponse(
data={
"results": results_list
}
)
except Exception as e:
return SuccessResponse(
status="False",
data={"error": f"Error: {e}"}
)
@app.get("/prono/xvid-dl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
async def xvid_download(link: str):
try:
x = xvid_client()
response = x.get_video(link)
return SuccessResponse(
data={
"results": {
"title": response.title,
"description": response.description,
"author": response.author,
"length": response.length,
"tags": response.tags,
"publish_date": response.publish_date,
"views": response.views,
"link": response.cdn_url,
"thumb": response.thumbnail_url
}
}
)
except Exception as e:
return SuccessResponse(
status="False",
randydev={"error": f"Error fucking: {e}"}
) |