This commit is contained in:
shmilylty
2019-08-07 01:32:49 +08:00
parent 8ba3b926ce
commit b628859d32
45 changed files with 253 additions and 172 deletions
+7 -3
View File
@@ -29,7 +29,8 @@ class GoogleAPI(Search):
time.sleep(self.delay)
self.header = self.get_header()
self.proxy = self.get_proxy(self.source)
params = {'key': self.key, 'cx': self.cx, 'q': word, 'fields': 'items/link',
params = {'key': self.key, 'cx': self.cx,
'q': word, 'fields': 'items/link',
'start': self.page_num, 'num': self.per_page_num}
resp = self.get(self.addr, params)
if not resp:
@@ -60,9 +61,12 @@ class GoogleAPI(Search):
# 递归搜索下一层的子域
if self.recursive_search:
for layer_num in range(1, self.recursive_times): # 从1开始是之前已经做过1层子域搜索了,当前实际递归层数是layer+1
# 从1开始是之前已经做过1层子域搜索了,当前实际递归层数是layer+1
for layer_num in range(1, self.recursive_times):
for subdomain in self.subdomains:
if subdomain.count('.') - self.domain.count('.') == layer_num: # 进行下一层子域搜索的限制条件
# 进行下一层子域搜索的限制条件
count = subdomain.count('.') - self.domain.count('.')
if count == layer_num:
self.search(subdomain)
self.save_json()