|
@@ -1,9 +1,9 @@
|
|
|
-from youtube_search import YoutubeSearch
|
|
|
|
|
from search_engine_parser import GoogleSearch
|
|
from search_engine_parser import GoogleSearch
|
|
|
from pyrogram import filters
|
|
from pyrogram import filters
|
|
|
from requests import get
|
|
from requests import get
|
|
|
-from wbb import app
|
|
|
|
|
|
|
+from wbb import app, ARQ
|
|
|
from wbb.utils.errors import capture_err
|
|
from wbb.utils.errors import capture_err
|
|
|
|
|
+from wbb.utils.fetch import fetch
|
|
|
|
|
|
|
|
__MODULE__ = "Search"
|
|
__MODULE__ = "Search"
|
|
|
__HELP__ = '''/ud - Search For Something In Urban Dictionary
|
|
__HELP__ = '''/ud - Search For Something In Urban Dictionary
|
|
@@ -22,12 +22,10 @@ async def urbandict(_, message):
|
|
|
await message.reply_text('"/ud" Needs An Argument.')
|
|
await message.reply_text('"/ud" Needs An Argument.')
|
|
|
return
|
|
return
|
|
|
text = message.text.split(None, 1)[1]
|
|
text = message.text.split(None, 1)[1]
|
|
|
- api = "http://api.urbandictionary.com/v0/define?term="
|
|
|
|
|
-
|
|
|
|
|
try:
|
|
try:
|
|
|
- results = get(f"{api}{text}").json()
|
|
|
|
|
- reply_text = f'Definition: {results["list"][0]["definition"]}'
|
|
|
|
|
- reply_text += f'\n\nExample: {results["list"][0]["example"]}'
|
|
|
|
|
|
|
+ results = await fetch(f"{ARQ}ud?query={text}")
|
|
|
|
|
+ reply_text = f"""Definition: {results["list"][0]["definition"]}
|
|
|
|
|
+Example: {results["list"][0]["example"]}"""
|
|
|
except IndexError:
|
|
except IndexError:
|
|
|
reply_text = ("Sorry could not find any matching results!")
|
|
reply_text = ("Sorry could not find any matching results!")
|
|
|
ignore_chars = "[]"
|
|
ignore_chars = "[]"
|
|
@@ -46,7 +44,7 @@ async def urbandict(_, message):
|
|
|
async def google(_, message):
|
|
async def google(_, message):
|
|
|
try:
|
|
try:
|
|
|
if len(message.command) < 2:
|
|
if len(message.command) < 2:
|
|
|
- await message.reply_text('"/google" Needs An Argument')
|
|
|
|
|
|
|
+ await message.reply_text('/google Needs An Argument')
|
|
|
return
|
|
return
|
|
|
text = message.text.split(None, 1)[1]
|
|
text = message.text.split(None, 1)[1]
|
|
|
gresults = await GoogleSearch().async_search(text, 1)
|
|
gresults = await GoogleSearch().async_search(text, 1)
|
|
@@ -133,10 +131,10 @@ async def ytsearch(_, message):
|
|
|
return
|
|
return
|
|
|
query = message.text.split(None, 1)[1]
|
|
query = message.text.split(None, 1)[1]
|
|
|
m = await message.reply_text("Searching....")
|
|
m = await message.reply_text("Searching....")
|
|
|
- results = YoutubeSearch(query, max_results=4).to_dict()
|
|
|
|
|
|
|
+ results = await fetch(f"{ARQ}youtube?query={query}&count=3")
|
|
|
i = 0
|
|
i = 0
|
|
|
text = ""
|
|
text = ""
|
|
|
- while i < 4:
|
|
|
|
|
|
|
+ while i < 3:
|
|
|
text += f"Title - {results[i]['title']}\n"
|
|
text += f"Title - {results[i]['title']}\n"
|
|
|
text += f"Duration - {results[i]['duration']}\n"
|
|
text += f"Duration - {results[i]['duration']}\n"
|
|
|
text += f"Views - {results[i]['views']}\n"
|
|
text += f"Views - {results[i]['views']}\n"
|