-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.py
executable file
·34 lines (28 loc) · 960 Bytes
/
module.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
from ytsearch import youtubeSearch
from bot import db_connect
def querry(mesage,peer,search,cursor,cnxn):
result = youtubeSearch(mesage)
# db_connect()
#global db.connect.cursor
#global cnxn
if result != "video not found":
for i in result:
a=i.split(",")
#print a
#int1++
title = "TiTTle : "+a[0]
link = "Link : "+a[1]
desc = "Description : "+a[2]
print title+"\n"+link+"\n"+desc+"\n"
try:
cursor.execute("insert into dbo.search_result(search_id, user_id, result, result_desc, link) values ( ?, ?, ?, ?, ?)", search, peer, title, desc, link)
except:
print "except"
cnxn.commit()
else:
print"else"
cursor.execute("insert into dbo.search_result(search_id, user_id, result) values ( ?, ?, ?)", search, peer, result)
cnxn.commit()
cursor.execute(""" UPDATE dbo.bot_search_querry SET flag = 1 where search_id = ?""", [search])
cnxn.commit()
return None