|
6 | 6 | from xlutils.copy import copy
|
7 | 7 | from selenium import webdriver
|
8 | 8 | import time
|
9 |
| -import datetime |
10 | 9 | from 飞鱼脚本.sendEmail import SendEmail
|
11 | 10 | from copy import deepcopy
|
12 | 11 | import requests
|
13 | 12 |
|
| 13 | +user_agent = "mozilla/5.0 (linux; u; android 4.1.2; zh-cn; mi-one plus build/jzo54k) applewebkit/534.30 (khtml, like gecko) version/4.0 mobile safari/534.30 micromessenger/5.0.1.352" |
14 | 14 | url = "https://feiyu.oceanengine.com/feiyu/login"
|
15 | 15 | send = SendEmail()
|
16 | 16 | user_list = ['1364826576@qq.com']
|
17 | 17 |
|
18 | 18 | phone_num = 13281890000
|
19 | 19 | wait_time = 3 # 各个阶段等待时间
|
20 | 20 | time_jiange = 30 # 时间间隔 隔多长时间执行脚本一次
|
21 |
| -start_date = time.mktime(time.strptime("2019-12-1 18:00:00", "%Y-%m-%d %H:%M:%S")) # 结束时间 |
| 21 | +start_date = time.mktime(time.strptime("2019-11-1 18:00:00", "%Y-%m-%d %H:%M:%S")) # 结束时间 |
22 | 22 | end_date = time.mktime(time.strptime("2019-12-12 18:00:00", "%Y-%m-%d %H:%M:%S")) # 结束时间
|
23 | 23 | ding_num = 5 # 链接条数报警阈值
|
24 | 24 |
|
@@ -66,10 +66,15 @@ def get_new_phone(start, end):
|
66 | 66 | i += 1
|
67 | 67 | for one in response['data']:
|
68 | 68 | # print(one['telphone'])
|
69 |
| - res.append(one['telphone']) |
| 69 | + if one['telphone'] not in totle_break_set: |
| 70 | + timeStamp = int(one['create_time']) |
| 71 | + timeArray = time.localtime(timeStamp) |
| 72 | + otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray) |
| 73 | + res.append([one['telphone'], otherStyleTime]) |
70 | 74 | else:
|
71 | 75 | break
|
72 | 76 | print("新爬取手机号{}个".format(len(res)))
|
| 77 | + print("手机号:{}".format(res)) |
73 | 78 | return res
|
74 | 79 |
|
75 | 80 |
|
@@ -278,56 +283,27 @@ def register(phone_data):
|
278 | 283 | except Exception as e:
|
279 | 284 | pass
|
280 | 285 |
|
281 |
| - # 发邮件 |
282 |
| - send.send_test(user_list, 0) |
283 |
| - print("链接已经全部用完 请及时补充!") |
284 |
| - # print(e) |
| 286 | + # # 发邮件 |
| 287 | + # send.send_test(user_list, 0) |
| 288 | + # print("链接已经全部用完 请及时补充!") |
| 289 | + # # print(e) |
285 | 290 |
|
286 | 291 |
|
287 | 292 | def main():
|
288 | 293 | crawl_count = 1
|
289 |
| - windows = "" |
290 |
| - second_window = '' |
291 | 294 | while 1:
|
292 |
| - |
293 |
| - # time_str = datetime.datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S") |
294 |
| - # print(times) |
295 |
| - # # s="2019.12.02 13:56:20" |
296 |
| - # # print(datetime.datetime.strptime(s,"%Y.%m.%d %H:%M:%S")<times) |
297 | 295 | if crawl_count == 1:
|
298 | 296 | print("第1次爬取")
|
299 |
| - # driver.get("https://e.douyin.com/site/manage-center/user-manage") |
300 |
| - # driver.get(url) |
301 |
| - |
302 |
| - # print("请您进行登录及手动进行所有的筛选") |
303 |
| - # yes = input("您是否已确认进行爬取") |
304 |
| - # cookie= driver.get_cookies() |
305 |
| - # driver.get("https://e.douyin.com/site/manage-center/user-manage") |
306 |
| - # phone_data = get_new_phone(start_date, end_date) |
307 |
| - # print([phone for phone in phone_data[0]]) |
308 |
| - # windows = driver.current_window_handle |
309 |
| - # js = 'window.open("https://www.baidu.com");' |
310 |
| - # driver.execute_script(js) |
311 |
| - # for wins in driver.window_handles: |
312 |
| - # if wins != windows: |
313 |
| - # driver.switch_to.window(wins) |
314 |
| - # second_window = driver.current_window_handle |
315 |
| - # y = input("是否设置完毕") |
316 | 297 | # 测试
|
317 | 298 | phone_data = get_new_phone(start_date, end_date)
|
318 |
| - print("o", phone_data) |
| 299 | + y = input("是否设置完毕") |
319 | 300 | register(phone_data)
|
320 |
| - driver.switch_to.window(windows) |
321 |
| - |
322 | 301 | crawl_count += 1
|
323 | 302 | else:
|
324 | 303 | print("第{}次爬取".format(crawl_count))
|
325 | 304 | times = int(time.time())
|
326 | 305 | phone_data = get_new_phone(end_date, times)
|
327 |
| - print(phone_data) |
328 |
| - # driver.switch_to.window(second_window) |
329 | 306 | register(phone_data)
|
330 |
| - # driver.switch_to.window(windows) |
331 | 307 | crawl_count += 1
|
332 | 308 |
|
333 | 309 | time.sleep(time_jiange)
|
|
0 commit comments