Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f9989df

Browse files
committed
飞鱼脚本
1 parent def4f6a commit f9989df

File tree

3 files changed

+13
-37
lines changed

3 files changed

+13
-37
lines changed

樊登读书脚本/link.xls

0 Bytes
Binary file not shown.

樊登读书脚本/phone_number.xls

21 KB
Binary file not shown.

飞鱼脚本/new_spider.py

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
from xlutils.copy import copy
77
from selenium import webdriver
88
import time
9-
import datetime
109
from 飞鱼脚本.sendEmail import SendEmail
1110
from copy import deepcopy
1211
import requests
1312

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"
1414
url = "https://feiyu.oceanengine.com/feiyu/login"
1515
send = SendEmail()
1616
user_list = ['1364826576@qq.com']
1717

1818
phone_num = 13281890000
1919
wait_time = 3 # 各个阶段等待时间
2020
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")) # 结束时间
2222
end_date = time.mktime(time.strptime("2019-12-12 18:00:00", "%Y-%m-%d %H:%M:%S")) # 结束时间
2323
ding_num = 5 # 链接条数报警阈值
2424

@@ -66,10 +66,15 @@ def get_new_phone(start, end):
6666
i += 1
6767
for one in response['data']:
6868
# 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])
7074
else:
7175
break
7276
print("新爬取手机号{}个".format(len(res)))
77+
print("手机号:{}".format(res))
7378
return res
7479

7580

@@ -278,56 +283,27 @@ def register(phone_data):
278283
except Exception as e:
279284
pass
280285

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)
285290

286291

287292
def main():
288293
crawl_count = 1
289-
windows = ""
290-
second_window = ''
291294
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)
297295
if crawl_count == 1:
298296
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("是否设置完毕")
316297
# 测试
317298
phone_data = get_new_phone(start_date, end_date)
318-
print("o", phone_data)
299+
y = input("是否设置完毕")
319300
register(phone_data)
320-
driver.switch_to.window(windows)
321-
322301
crawl_count += 1
323302
else:
324303
print("第{}次爬取".format(crawl_count))
325304
times = int(time.time())
326305
phone_data = get_new_phone(end_date, times)
327-
print(phone_data)
328-
# driver.switch_to.window(second_window)
329306
register(phone_data)
330-
# driver.switch_to.window(windows)
331307
crawl_count += 1
332308

333309
time.sleep(time_jiange)

0 commit comments

Comments
 (0)