2018-11-21 01:04:57 +08:00
|
|
|
import myparser
|
|
|
|
import time
|
|
|
|
import requests
|
2018-12-18 13:21:05 +08:00
|
|
|
from discovery.constants import *
|
2018-11-21 01:04:57 +08:00
|
|
|
|
|
|
|
class search_yahoo:
|
|
|
|
|
|
|
|
def __init__(self, word, limit):
|
|
|
|
self.word = word
|
|
|
|
self.total_results = ""
|
|
|
|
self.server = "search.yahoo.com"
|
|
|
|
self.hostname = "search.yahoo.com"
|
|
|
|
self.limit = limit
|
|
|
|
self.counter = 0
|
|
|
|
|
|
|
|
def do_search(self):
|
|
|
|
url = 'http://' + self.server + "/search?p=\"%40" + self.word \
|
|
|
|
+ "\"&b=" + str(self.counter) + "&pz=10"
|
|
|
|
headers = {
|
|
|
|
'Host': self.hostname,
|
2018-12-18 13:21:05 +08:00
|
|
|
'User-agent': getUserAgent()
|
2018-11-21 01:04:57 +08:00
|
|
|
}
|
|
|
|
h = requests.get(url=url, headers=headers)
|
|
|
|
self.total_results += h.text
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
while self.counter <= self.limit and self.counter <= 1000:
|
|
|
|
self.do_search()
|
2018-12-18 13:21:05 +08:00
|
|
|
time.sleep(getDelay())
|
2018-11-21 01:04:57 +08:00
|
|
|
print("\tSearching " + str(self.counter) + " results...")
|
|
|
|
self.counter += 10
|
|
|
|
|
|
|
|
def get_emails(self):
|
|
|
|
rawres = myparser.parser(self.total_results, self.word)
|
|
|
|
return rawres.emails()
|
|
|
|
|
|
|
|
def get_hostnames(self):
|
|
|
|
rawres = myparser.parser(self.total_results, self.word)
|
|
|
|
return rawres.hostnames()
|