This repository has been archived by the owner on Apr 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.py
52 lines (42 loc) · 1.84 KB
/
search.py
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
# -*- coding:utf-8 -*-
##########################################################
# Rutap Bot 2019 Search Module #
# Under The MIT License #
##########################################################
import discord, requests, json, random, setting
from bs4 import BeautifulSoup as bs4
Setting = setting.Settings()
normal_neko_tag = ['neko', 'avatar', 'holo', 'kemonomimi', 'meow', 'waifu', 'tickle', 'feed', 'poke', 'slap', 'cuddle', 'hug', 'pat']
lewd_neko_tag = ['ero', 'eron', 'erofeet', 'erouri', 'lewd', 'keta', 'yuri', 'nsfw_avatar', 'hentai', 'anal', 'femdom', 'cum', 'solo', 'pussy', 'tits', 'smallboobs', 'feet', 'ngif', 'hentaig', 'nsfwg', 'classic', 'solog', 'pussyg', 'boobs', 'pwankg', 'feetg', 'trap', 'futanari', 'gasm', 'wallpaper']
def normal_neko(message, tag):
tag = tag.replace('\t', '')
tag = tag.replace(' ', '')
if tag == None or tag == "" or tag == " ":
tag = 'neko'
if not tag in normal_neko_tag:
return False
r = requests.get("https://nekos.life/api/v2/img/%s" % tag)
r = r.text
data = json.loads(r)
file = data["url"]
return file, tag
def nsfw_neko(message, tag):
tag = tag.replace('\t', '')
tag = tag.replace(' ', '')
if tag == None or tag == "" or tag == " ":
tag = 'lewd'
if not tag in lewd_neko_tag and not tag in normal_neko_tag:
return False
r = requests.get("https://nekos.life/api/v2/img/%s" % tag)
r = r.text
data = json.loads(r)
file = data["url"]
return file, tag
def img_search(message, q):
q = q.encode("raw_unicode_escape")
q = str(q)
data = requests.get("https://www.google.co.kr/search?q=" + q + "&source=lnms&tbm=isch&sa=X")
soup = bs4(data.text, "html.parser")
imgs = soup.find_all("img")
file = random.choice(imgs[1:])['src']
return file