Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.

Commit

Permalink
simsimi & igdownloader
Browse files Browse the repository at this point in the history
  • Loading branch information
Krypton-Byte committed Oct 20, 2020
1 parent a9bdb42 commit 7dd0f38
Show file tree
Hide file tree
Showing 18 changed files with 1,157 additions and 105 deletions.
Binary file added cache/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from lib.sdmovie import fun
from lib.chatbot import chatbot
from lib.cropToSquare import crop_image, resizeTo, pasteLayer
from lib.menu import menu
from lib.api import *
from lib.kasar import *
from lib.brainly2 import *
from lib.nulis import tulis
from lib.anime import *
from lib.ig import igdownload
Binary file added lib/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified lib/__pycache__/anime.cpython-38.pyc
Binary file not shown.
Binary file modified lib/__pycache__/brainly.cpython-38.pyc
Binary file not shown.
Binary file added lib/__pycache__/brainly2.cpython-38.pyc
Binary file not shown.
Binary file modified lib/__pycache__/chatbot.cpython-38.pyc
Binary file not shown.
Binary file added lib/__pycache__/ig.cpython-38.pyc
Binary file not shown.
Binary file modified lib/__pycache__/menu.cpython-38.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions lib/anime.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
'''
@Author : MhankBarBar
@Github : https://github.com/MhankBarBar
'''
from requests import get
from bs4 import BeautifulSoup as bs
import json
Expand Down
4 changes: 2 additions & 2 deletions lib/brainly.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def brainly(url):
url : string
e.g brainly("https://brainly.co.id/tugas/2754169")
'''
headers={'user-agent':"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4183.102 Safari/537.36"}
headers={'user-agent':"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36"}
get=requests.get(url, headers=headers)
bs=BeautifulSoup(get.text,'html.parser')
Tangg=bs.find_all('span',class_='sg-text sg-text--xsmall sg-text--gray-secondary')[0]('time')[0]['title']
Expand All @@ -28,4 +28,4 @@ def brainly(url):
'mapel':mapel,
'tanggal':Tangg,
'jawaban':answer
}
}
26 changes: 26 additions & 0 deletions lib/brainly2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import requests, re, random
from urllib.parse import quote
from bs4 import BeautifulSoup
def gsearch(query):
'''
query : String
'''
src = requests.get("https://www.google.com/search?q="+quote(query)).text
return re.findall('<a href="/url\?q\=(.*?)\&amp;',src)
def brainly(url):
'''
url : string
e.g brainly("https://brainly.co.id/tugas/2754169")
'''
headers={'user-agent':"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4183.102 Safari/537.36"}
get=requests.get(url, headers=headers)
bs=BeautifulSoup(get.text,'html.parser')
answer=""
pertanyaan=bs.find_all('span',class_='sg-text sg-text--large sg-text--bold sg-text--break-words brn-qpage-next-question-box-content__primary')[0].text
for jw in bs.find_all("div", class_="sg-text sg-text--break-words brn-rich-content js-answer-content"):
for jawaban in jw.find_all("p"):
answer+="\n%s"%jawaban.text
return {
'soal':pertanyaan,
'jawaban':answer.strip()
}
68 changes: 14 additions & 54 deletions lib/chatbot.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,14 @@
import random
class chatBot:
'''input chat e.g chatbot("Hi")'''
def __init__(self, req):
self.req = req.lower().split()
self.list_ask = ["aku","sayang","kamu"]
self.balas_ask = ["same",":)","kamu bilang apa"]
self.list_odading = ["hiu","tomat"]
self.list_intro = ["hi","hai","hello","hai","p","bro","halo","hallo","helo"]
self.balas_intro = ["iya","ada apa gan","ya hallo","ada apaan gan","Ya"]
self.list_rumah = ["dimana","rumah","kamu","tempat","tinggal","daerah","di","mana"];
self.balas_rumah = ["Jawa Barat","jawa Tengah","Jawa Timur"]
self.list_nama = ["siapa","nama","kamu","namanya"]
self.balas_nama = ["nama saya chappie","nama saya chappie atau bisa di sebut Bot whatsapp"]
self.list_author = ["siapa","author","pembuat","pencipta","menciptakan","kamu"]
self.balas_author = ["Ntah","saya Tidak Tahu"]
self.list_salam = ["assalamu'alaikum","asalamualaikum"]
self.balas_salam = ["wa'alaikumsalam","Wa'alaikumsalam"]
self.list_fav_makanan = ["makanan","favorit","kesukaan"]
self.balas_fav_makanan = ["Nasi Goreng","Telur Ceplok","Mie Goreng"]
def max_(self):
self.rumah = len(set(self.list_rumah) & set(self.req))
self.nama = len(set(self.list_nama) & set(self.req))
self.author = len(set(self.list_author) & set(self.req))
self.salam = len(set(self.list_salam) & set(self.req))
self.intro = len(set(self.list_intro) & set(self.req))
self.fav_makanan = len(set(self.list_fav_makanan) & set(self.req))
self.ask = len(set(self.list_ask) & set(self.req))
self.odading = len(set(self.list_odading) & set(self.req))
self.list=[self.rumah, self.nama, self.author, self.salam, self.fav_makanan, self.intro, self.ask, self.odading]
def balas(self):
maks=max(self.list)
if 'bot' in self.req and set(['goblok','tolol'])&set(self.req):
return random.choice(["yg main bot gk ada akhlak","nama nya juga bot","aku ini bukan bot sepeti ML (machine learning) yg bisa di ajarin"])
elif maks == 0:
return False
elif self.rumah == maks:
return random.choice(self.balas_rumah)
elif self.nama == maks:
return random.choice(self.balas_nama)
elif self.author == maks:
return random.choice(self.balas_author)
elif self.salam == maks:
return random.choice(self.balas_salam)
elif self.fav_makanan == maks:
return random.choice(self.balas_fav_makanan)
elif self.intro == maks:
return random.choice(self.balas_intro)
elif self.ask == maks:
return random.choice(self.balas_ask)
elif self.odading == maks:
return "Goblok !!!"


import requests, json
def chatbot(question):
headers = {
'content-type': 'application/json',
'x-api-key': 'bnqqPT2Hq0UJVTKtmMeiAz6DaUjBaE8-jA0ap_UX'
}
data = {
'utext': question,
'lang': 'id',
'country': ['ID'],
'atext_bad_prob_max': '0.7'
}
req=requests.post("https://wsapi.simsimi.com/190410/talk/",data=json.dumps(data), headers=headers)
return req.json().get("atext","Simi Lagi Sibuk :)")
4 changes: 4 additions & 0 deletions lib/dewabatch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
'''
@Author : MhankBarBar
@Github : https://github.com/MhankBarBar
'''
from requests import *
from googlesearch import *
from urllib.parse import *
Expand Down
19 changes: 19 additions & 0 deletions lib/ig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'''
@author : Krypton Byte
'''
import requests
def igdownload(url):
req=requests.get(url, params={"__a":1})
if ('graphql' in req.text):
media=req.json()["graphql"]["shortcode_media"]
if media.get("is_video"):
return {"status": True,"result":[{"type":"video", "url":media["video_url"]}]}
elif media.get("edge_sidecar_to_children"): #multiple media
med={"status":True, "result":[]}
for i in media["edge_sidecar_to_children"]["edges"]:
med["result"].append( {"type":"video","url":i["node"]["video_url"]} if i["node"]["is_video"] else {"type":"image","url":i["node"]["display_resources"][-1]["src"]})
return med
else: #1 media
return {"status":True,"result":[{"type":"image","url":media["display_resources"][-1]["src"]}]}
else:
return {"status":False}
2 changes: 1 addition & 1 deletion lib/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
''',
'bot':'''
-> # <q>
-> #qa Q|A
''',
'alat':'''
-> #sticker
-> #upimg
-> #ig
-> #cari
-> #qrmaker
-> #qrreader
Expand Down
Loading

0 comments on commit 7dd0f38

Please sign in to comment.