2019-01-11 10:09:47 +08:00
|
|
|
from lib.core import *
|
2018-12-28 08:49:56 +08:00
|
|
|
from parsers import myparser
|
|
|
|
import requests
|
|
|
|
|
|
|
|
|
|
|
|
class search_google_labs:
|
|
|
|
|
|
|
|
def __init__(self, list):
|
|
|
|
self.results = ""
|
|
|
|
self.totalresults = ""
|
|
|
|
self.server = "labs.google.com"
|
|
|
|
self.hostname = "labs.google.com"
|
|
|
|
id = 0
|
|
|
|
self.set = ""
|
|
|
|
for x in list:
|
|
|
|
id += 1
|
|
|
|
if id == 1:
|
|
|
|
self.set = self.set + "q" + str(id) + "=" + str(x)
|
|
|
|
else:
|
|
|
|
self.set = self.set + "&q" + str(id) + "=" + str(x)
|
|
|
|
|
|
|
|
def do_search(self):
|
|
|
|
url = 'http://' + self.server + "/sets?hl-en&" + self.set
|
|
|
|
headers = {
|
|
|
|
'Host': self.server,
|
2019-01-06 17:50:07 +08:00
|
|
|
'User-agent': Core.get_user_agent()
|
2018-12-28 08:49:56 +08:00
|
|
|
}
|
|
|
|
h = requests.get(url=url, headers=headers)
|
|
|
|
self.results = h.text
|
|
|
|
self.totalresults += self.results
|
|
|
|
|
|
|
|
def get_set(self):
|
2019-01-06 17:50:07 +08:00
|
|
|
rawres = myparser.Parser(self.totalresults, list)
|
2018-12-28 08:49:56 +08:00
|
|
|
return rawres.set()
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
self.do_search()
|