randydev commited on
Commit
20265ba
1 Parent(s): 45dc229

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +151 -0
main.py CHANGED
@@ -289,6 +289,157 @@ async def youtube_api(payload: YouTubeBase):
289
  randydev={"error": f"An error occurred: {str(e)}"}
290
  )
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  @app.get("/akeno/toanime", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
293
  async def toanimes(file_path=None):
294
  try:
 
289
  randydev={"error": f"An error occurred: {str(e)}"}
290
  )
291
 
292
+ async def tebakgambar():
293
+ try:
294
+ response = requests.get('https://jawabantebakgambar.net/all-answers/')
295
+ response.raise_for_status()
296
+ soup = BeautifulSoup(response.text, 'html.parser')
297
+ random_num = random.randint(2, 2836)
298
+ link2 = 'https://jawabantebakgambar.net'
299
+ selected_item = soup.select_one(f'#images > li:nth-child({random_num}) > a')
300
+ if selected_item:
301
+ img = link2 + selected_item.find('img').get('data-src')
302
+ jwb = selected_item.find('img').get('alt')
303
+ result = {
304
+ "message": "By Randydev",
305
+ "image": img,
306
+ "jawaban": jwb
307
+ }
308
+ return result
309
+ else:
310
+ raise ValueError("Selected item not found.")
311
+ except Exception:
312
+ return None
313
+
314
+ async def fbdown_hack(link):
315
+ try:
316
+ data = {"url": link}
317
+ headers = {
318
+ "content-type": "application/x-www-form-urlencoded",
319
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
320
+ "cookie": "_ga=GA1.2.1310699039.1624884412; _pbjs_userid_consent_data=3524755945110770; cto_bidid=rQH5Tl9NNm5IWFZsem00SVVuZGpEd21sWnp0WmhUeTZpRXdkWlRUOSUyQkYlMkJQQnJRSHVPZ3Fhb1R2UUFiTWJuVGlhVkN1TGM2anhDT1M1Qk0ydHlBb21LJTJGNkdCOWtZalRtZFlxJTJGa3FVTG1TaHlzdDRvJTNE; cto_bundle=g1Ka319NaThuSmh6UklyWm5vV2pkb3NYaUZMeWlHVUtDbVBmeldhNm5qVGVwWnJzSUElMkJXVDdORmU5VElvV2pXUTJhQ3owVWI5enE1WjJ4ZHR5NDZqd1hCZnVHVGZmOEd0eURzcSUyQkNDcHZsR0xJcTZaRFZEMDkzUk1xSmhYMlY0TTdUY0hpZm9NTk5GYXVxWjBJZTR0dE9rQmZ3JTNEJTNE; _gid=GA1.2.908874955.1625126838; __gads=ID=5be9d413ff899546-22e04a9e18ca0046:T=1625126836:RT=1625126836:S=ALNI_Ma0axY94aSdwMIg95hxZVZ-JGNT2w; cookieconsent_status=dismiss"
321
+ }
322
+ response = requests.post('https://www.getfvid.com/downloader', data=data, headers=headers)
323
+ response.raise_for_status()
324
+ soup = BeautifulSoup(response.text, 'html.parser')
325
+ normal_video = soup.select_one('div.col-md-4.btns-download > p:nth-child(2) > a').get('href')
326
+ hd_video = soup.select_one('div.col-md-4.btns-download > p:nth-child(1) > a').get('href')
327
+ audio = soup.select_one('div.col-md-4.btns-download > p:nth-child(3) > a').get('href')
328
+ return {
329
+ "normal_video": normal_video,
330
+ "HD": hd_video,
331
+ "audio": audio
332
+ }
333
+ except Exception:
334
+ return None
335
+
336
+ async def HentaiAnime():
337
+ try:
338
+ page = random.randint(1, 1153)
339
+ response = requests.get(f'https://sfmcompile.club/page/{page}')
340
+ response.raise_for_status()
341
+ soup = BeautifulSoup(response.text, 'html.parser')
342
+ hasil = []
343
+ articles = soup.select('#primary > div > div > ul > li > article')
344
+ for article in articles:
345
+ title = article.select_one('header > h2').text
346
+ link = article.select_one('header > h2 > a')['href']
347
+ category = article.select_one('header > div.entry-before-title > span > span').text.replace('in ', '')
348
+ share_count = article.select_one('header > div.entry-after-title > p > span.entry-shares').text
349
+ views_count = article.select_one('header > div.entry-after-title > p > span.entry-views').text
350
+ type_ = article.select_one('source')['type'] if article.select_one('source') else 'image/jpeg'
351
+ video_1 = article.select_one('source')['src'] if article.select_one('source') else article.select_one('img')['data-src']
352
+ video_2 = article.select_one('video > a')['href'] if article.select_one('video > a') else ''
353
+ hasil.append({
354
+ "title": title,
355
+ "link": link,
356
+ "category": category,
357
+ "share_count": share_count,
358
+ "views_count": views_count,
359
+ "type": type_,
360
+ "video_1": video_1,
361
+ "video_2": video_2
362
+ })
363
+ if not hasil:
364
+ return {'developer': '@xtdevs', 'error': 'no result found'}
365
+ return hasil
366
+ except Exception:
367
+ return None
368
+
369
+ async def hapyymod(q):
370
+ host = "https://happymod.com"
371
+ response = requests.get(f"{host}/search.html?q={q}")
372
+ if response.status_code != 200:
373
+ return {"status": response.status_code, "result": []}
374
+ html = response.text
375
+ soup = BeautifulSoup(html, 'html.parser')
376
+ tez = soup.select("body > div.container-row.clearfix.container-wrap > div.container-left > section > div.pdt-app-box")
377
+ if not tez:
378
+ return {"status": 404, "result": []}
379
+ res = []
380
+ for item in tez:
381
+ link = host + item.find("a")["href"]
382
+ title = item.find("a")["title"]
383
+ thumb = item.find("img")["data-original"]
384
+ res.append({"title": title, "link": link, "thumb": thumb})
385
+ return {"status": 200, "creator": "@xtdevs", "result": res}
386
+
387
+ @app.get("/akeno/happymod", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
388
+ async def happymods_(q: str):
389
+ try:
390
+ response = await hapyymod(q)
391
+ return SuccessResponse(
392
+ status="True",
393
+ randydev={"results": response}
394
+ )
395
+ except:
396
+ return SuccessResponse(
397
+ status="False",
398
+ randydev={"error": "Error fucking"}
399
+ )
400
+
401
+ @app.get("/akeno/hentai", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
402
+ async def hentai_():
403
+ try:
404
+ response = await HentaiAnime()
405
+ return SuccessResponse(
406
+ status="True",
407
+ randydev={"results": response}
408
+ )
409
+ except:
410
+ return SuccessResponse(
411
+ status="False",
412
+ randydev={"error": "Error fucking"}
413
+ )
414
+
415
+ @app.get("/akeno/fbdown", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
416
+ async def fbdown_(link: str):
417
+ try:
418
+ response = await fbdown_hack(link)
419
+ return SuccessResponse(
420
+ status="True",
421
+ randydev={"results": response}
422
+ )
423
+ except:
424
+ return SuccessResponse(
425
+ status="False",
426
+ randydev={"error": "Error fucking"}
427
+ )
428
+
429
+ @app.get("/akeno/tebakgambar", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
430
+ async def tebakgambar_answer():
431
+ try:
432
+ response = await tebakgambar()
433
+ return SuccessResponse(
434
+ status="True",
435
+ randydev={"results": response}
436
+ )
437
+ except:
438
+ return SuccessResponse(
439
+ status="False",
440
+ randydev={"error": "Error fucking"}
441
+ )
442
+
443
  @app.get("/akeno/toanime", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
444
  async def toanimes(file_path=None):
445
  try: