diff --git a/bingdwendwen.py b/bingdwendwen.py new file mode 100644 index 0000000..ff2a407 --- /dev/null +++ b/bingdwendwen.py @@ -0,0 +1,369 @@ +import turtle + +turtle.title('冰墩墩') + +turtle.speed(100) # 速度 + +# 左手 +turtle.penup() +turtle.goto(177, 112) +turtle.pencolor("lightgray") +turtle.pensize(3) +turtle.fillcolor("white") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(80) +turtle.circle(-45, 200) +turtle.circle(-300, 23) +turtle.end_fill() + +# 左手内 +turtle.penup() +turtle.goto(182, 95) +turtle.pencolor("black") +turtle.pensize(1) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.setheading(95) +turtle.pendown() +turtle.circle(-37, 160) +turtle.circle(-20, 50) +turtle.circle(-200, 30) +turtle.end_fill() +# 轮廓 +# 头顶 +turtle.penup() +turtle.goto(-73, 230) +turtle.pencolor("lightgray") +turtle.pensize(3) +turtle.fillcolor("white") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(20) +turtle.circle(-250, 35) +# 左耳 +turtle.setheading(50) +turtle.circle(-42, 180) +# 左侧 +turtle.setheading(-50) +turtle.circle(-190, 30) +turtle.circle(-320, 45) +# 左腿 +turtle.circle(120, 30) +turtle.circle(200, 12) +turtle.circle(-18, 85) +turtle.circle(-180, 23) +turtle.circle(-20, 110) +turtle.circle(15, 115) +turtle.circle(100, 12) +# 右腿 +turtle.circle(15, 120) +turtle.circle(-15, 110) +turtle.circle(-150, 30) +turtle.circle(-15, 70) +turtle.circle(-150, 10) +turtle.circle(200, 35) +turtle.circle(-150, 20) +# 右手 +turtle.setheading(-120) +turtle.circle(50, 30) +turtle.circle(-35, 200) +turtle.circle(-300, 23) +# 右侧 +turtle.setheading(86) +turtle.circle(-300, 26) +# 右耳 +turtle.setheading(122) +turtle.circle(-53, 160) +turtle.end_fill() + +# 右耳内 +turtle.penup() +turtle.goto(-130, 180) +turtle.pencolor("black") +turtle.pensize(1) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(120) +turtle.circle(-28, 160) +turtle.setheading(210) +turtle.circle(150, 20) +turtle.end_fill() + +# 左耳内 +turtle.penup() +turtle.goto(90, 230) +turtle.setheading(40) +turtle.begin_fill() +turtle.pendown() +turtle.circle(-30, 170) +turtle.setheading(125) +turtle.circle(150, 23) +turtle.end_fill() + +# 右手内 +turtle.penup() +turtle.goto(-180, -55) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.setheading(-120) +turtle.pendown() +turtle.circle(50, 30) +turtle.circle(-27, 200) +turtle.circle(-300, 20) +turtle.setheading(-90) +turtle.circle(300, 14) +turtle.end_fill() + +# 左腿内 +turtle.penup() +turtle.goto(108, -168) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(-115) +turtle.circle(110, 15) +turtle.circle(200, 10) +turtle.circle(-18, 80) +turtle.circle(-180, 13) +turtle.circle(-20, 90) +turtle.circle(15, 60) +turtle.setheading(42) +turtle.circle(-200, 29) +turtle.end_fill() +# 右腿内 +turtle.penup() +turtle.goto(-38, -210) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(-155) +turtle.circle(15, 100) +turtle.circle(-10, 110) +turtle.circle(-100, 30) +turtle.circle(-15, 65) +turtle.circle(-100, 10) +turtle.circle(200, 15) +turtle.setheading(-14) +turtle.circle(-200, 27) +turtle.end_fill() + +# 右眼 +# 眼圈 +turtle.penup() +turtle.goto(-64, 120) +turtle.begin_fill() +turtle.pendown() +turtle.setheading(40) +turtle.circle(-35, 152) +turtle.circle(-100, 50) +turtle.circle(-35, 130) +turtle.circle(-100, 50) +turtle.end_fill() +# 眼珠 +turtle.penup() +turtle.goto(-47, 55) +turtle.fillcolor("white") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(25, 360) +turtle.end_fill() +turtle.penup() +turtle.goto(-45, 62) +turtle.pencolor("darkslategray") +turtle.fillcolor("darkslategray") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(19, 360) +turtle.end_fill() +turtle.penup() +turtle.goto(-45, 68) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(10, 360) +turtle.end_fill() +turtle.penup() +turtle.goto(-47, 86) +turtle.pencolor("white") +turtle.fillcolor("white") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(5, 360) +turtle.end_fill() + +# 左眼 +# 眼圈 +turtle.penup() +turtle.goto(51, 82) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(120) +turtle.circle(-32, 152) +turtle.circle(-100, 55) +turtle.circle(-25, 120) +turtle.circle(-120, 45) +turtle.end_fill() +# 眼珠 +turtle.penup() +turtle.goto(79, 60) +turtle.fillcolor("white") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(24, 360) +turtle.end_fill() +turtle.penup() +turtle.goto(79, 64) +turtle.pencolor("darkslategray") +turtle.fillcolor("darkslategray") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(19, 360) +turtle.end_fill() +turtle.penup() +turtle.goto(79, 70) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(10, 360) +turtle.end_fill() +turtle.penup() +turtle.goto(79, 88) +turtle.pencolor("white") +turtle.fillcolor("white") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(0) +turtle.circle(5, 360) +turtle.end_fill() + +# 鼻子 +turtle.penup() +turtle.goto(37, 80) +turtle.fillcolor("black") +turtle.begin_fill() +turtle.pendown() +turtle.circle(-8, 130) +turtle.circle(-22, 100) +turtle.circle(-8, 130) +turtle.end_fill() + +# 嘴 +turtle.penup() +turtle.goto(-15, 48) +turtle.setheading(-36) +turtle.begin_fill() +turtle.pendown() +turtle.circle(60, 70) +turtle.setheading(-132) +turtle.circle(-45, 100) +turtle.end_fill() + +# 彩虹圈 +turtle.penup() +turtle.goto(-135, 120) +turtle.pensize(5) +turtle.pencolor("cyan") +turtle.pendown() +turtle.setheading(60) +turtle.circle(-165, 150) +turtle.circle(-130, 78) +turtle.circle(-250, 30) +turtle.circle(-138, 105) +turtle.penup() +turtle.goto(-131, 116) +turtle.pencolor("slateblue") +turtle.pendown() +turtle.setheading(60) +turtle.circle(-160, 144) +turtle.circle(-120, 78) +turtle.circle(-242, 30) +turtle.circle(-135, 105) +turtle.penup() +turtle.goto(-127, 112) +turtle.pencolor("orangered") +turtle.pendown() +turtle.setheading(60) +turtle.circle(-155, 136) +turtle.circle(-116, 86) +turtle.circle(-220, 30) +turtle.circle(-134, 103) +turtle.penup() +turtle.goto(-123, 108) +turtle.pencolor("gold") +turtle.pendown() +turtle.setheading(60) +turtle.circle(-150, 136) +turtle.circle(-104, 86) +turtle.circle(-220, 30) +turtle.circle(-126, 102) +turtle.penup() +turtle.goto(-120, 104) +turtle.pencolor("greenyellow") +turtle.pendown() +turtle.setheading(60) +turtle.circle(-145, 136) +turtle.circle(-90, 83) +turtle.circle(-220, 30) +turtle.circle(-120, 100) +turtle.penup() + +# 爱心 +turtle.penup() +turtle.goto(220, 115) +turtle.pencolor("brown") +turtle.pensize(1) +turtle.fillcolor("brown") +turtle.begin_fill() +turtle.pendown() +turtle.setheading(36) +turtle.circle(-8, 180) +turtle.circle(-60, 24) +turtle.setheading(110) +turtle.circle(-60, 24) +turtle.circle(-8, 180) +turtle.end_fill() + +# 五环 +turtle.penup() +turtle.goto(-5, -170) +turtle.pendown() +turtle.pencolor("blue") +turtle.circle(6) +turtle.penup() +turtle.goto(10, -170) +turtle.pendown() +turtle.pencolor("black") +turtle.circle(6) +turtle.penup() +turtle.goto(25, -170) +turtle.pendown() +turtle.pencolor("brown") +turtle.circle(6) +turtle.penup() +turtle.goto(2, -175) +turtle.pendown() +turtle.pencolor("lightgoldenrod") +turtle.circle(6) +turtle.penup() +turtle.goto(16, -175) +turtle.pendown() +turtle.pencolor("green") +turtle.circle(6) +turtle.penup() + +turtle.pencolor("black") +turtle.goto(-16, -160) +turtle.write("BEIJING 2022", font=('Arial', 10, 'bold italic')) +turtle.hideturtle() + +turtle.done() \ No newline at end of file diff --git a/excel_merge/excel_merge.py b/excel_merge/excel_merge.py new file mode 100644 index 0000000..46fc8bf --- /dev/null +++ b/excel_merge/excel_merge.py @@ -0,0 +1,35 @@ +""" + +注意: + +1. 第一次运行时需要安装了python环境 +2. 第一次运行时需要安装 pandas 包, 命令是: pip install pandas +3. 将要待合并的excel文件(如果是压缩包请先解压)放在和本脚本同级目录下的data文件夹中(没有data文件夹就创建个新的) +4. 打开cmd命令行,切换到本脚本所在目录,开始执行 python excel_merge.py +5. 观察输出的提示内容, 等待合并结果 + +""" + + +import os + + +import datetime +import pandas as pd + +cwd = os.path.abspath('data') +files = os.listdir(cwd) + +print("一共有" + str(len(files)) + "个文件待合并") +df = pd.DataFrame() +print("开始合并。。。。。") +for file in files: + if file.endswith('.xlsx'): + df = df.append(pd.read_excel("data/" + file), ignore_index=True) +df.head() + +now = datetime.datetime.now().strftime("%Y%m%d%H%M%S") +new_name = f"合并文件_{now}.xlsx" + +df.to_excel(new_name) +print(f"合并完成,生成文件:{new_name}") diff --git a/gzh/__init__.py b/gzh/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gzh/users.py b/gzh/users.py new file mode 100644 index 0000000..8d8c469 --- /dev/null +++ b/gzh/users.py @@ -0,0 +1,99 @@ +""" +导出公众号用户 +""" +import csv +import pprint + +import requests + +field_order = ["用户", "关注时间", "头像", ] + +csv.register_dialect('myDialect', + quoting=csv.QUOTE_ALL, + skipinitialspace=True) + +url = "https://mp.weixin.qq.com/cgi-bin/user_tag" + +params = { + "action": "get_user_list", + "groupid": -2, + "begin_openid": "", + "begin_create_time": 1633689214, + "limit": 20, + "offset": 0, + "backfoward": 1, + "token": 1830971770, + "lang": "zh_CN", + "f": "json", + "ajax": 1, + "random": 0.29653470243423685, +} + +headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36", + "HOST": "mp.weixin.qq.com", + "Cookie": "appmsglist_action_2393828411=card; appmsglist_action_2393291452=card; appmsglist_action_2397322000=card; pgv_pvid=5422600736; RK=FAIdRbY8Hq; ptcz=f284ef07e30510ca4de096c3a2c609c24239ce649730ff32922337bcbc96c62c; tvfe_boss_uuid=eda94597299f6f90; o_cookie=253421576; pac_uid=1_253421576; _ga=GA1.2.11487159.1587366826; iip=0; pt_sms_phone=158******20; wxuin=03951858983307; openid2ticket_o8uaO6kKiXBtnsUlETb2A4RtJpp4=; UM_distinctid=17944bc50b4c-0cf5c1c972f9ea-3f356b-1fa400-17944bc50b52c2; eas_sid=W1B6e2c1P3o2s825h7L449n642; mm_lang=zh_CN; CNZZDATA1272960370=1269357260-1592369408-https%253A%252F%252Fmp.weixin.qq.com%252F%7C1624334587; CNZZDATA1272425418=1699923129-1592372262-https%253A%252F%252Fmp.weixin.qq.com%252F%7C1624333219; ua_id=8vO2bkcLMNeldl9JAAAAAARMJnerzvqXqrhZO5-2ZL4=; _tc_unionid=28741bd1-95d8-4004-b608-c93597a49688; ptui_loginuin=3152728896; rewardsn=; wxtokenkey=777; wyctoken=1047229450; cert=r_gnLEwDCmRmSctNwSzh7aFRv5ljtc8i; noticeLoginFlag=1; openid2ticket_om422jrdTnEAB1r7-zXTmKubGER0=qqaTXD9mZypTBOgsxUAKpwokMgP0bslDrUl51B0AtzU=; pgv_info=ssid=s3224305654; __root_domain_v=.weixin.qq.com; _qddaz=QD.685431855347487; qm_authimgs_id=1; qm_verifyimagesession=h01288f28f42f57f799b739f029a1fd6dd00411cc253d46ef3c49e95a203eb481fa1872a9d7cd2d9ac8; uin=o3152728896; skey=@qa7daF93n; verifysession=h0198482c9a961b40d48d9be0c086737b622244718f7f0b716609bf466f2589f1d5e39e3e720cccc715; openid2ticket_oPGiXjhP6KzS5g8fMV3OHuuZkwmg=G+j8HQkDFdF5q0VfaEJrQ9g2Fw5KhQ4O/4IQ2BIqBa0=; remember_acct=253421576%40qq.com; openid2ticket_ow-uujmHSiUtZWYpm7jDnwkAnt44=CTJSCoZR2Y7HbBnUXOhcSyKCah+fm/M44cd93sTGaEc=; _qpsvr_localtk=1633743705330; uuid=42c3b6618c2e2428b33c9d77957f072b; rand_info=CAESIB3yvUn/wRelwvbLVgFflUsR7vvGg5J5npDY/aewR4nE; slave_bizuin=3579961954; data_bizuin=3579961954; bizuin=3579961954; data_ticket=o4ZvZYyx/3A+0PYP8WZ9QcNHQaiFooXo+IELaIF/86dMx3jouQzyLaiLss/DYfGb; slave_sid=dlJmODk5cGdEaUNycVFDZnlyZU9QZ0ZNazZTdmNWZjQwOGN3QVVTME93VU9fMEVMS1JZUk93ZF94S25Ga1NfX3JRcEJQRml3a2p3RzJRTkZkZEpGWDVSd0tmUUE2UkJQeWlHTHZoWjg1ZEkwWVZhbEhQREFDb3ptMUVKWUI3Z3paQUtjaE03OURBa09nSUsz; slave_user=gh_a0467681d76f; xid=297e610c2b2fa8697d48ecd9e05ce948" +} + +cookie = { + "verifysession": "", + "data_ticket": "o4ZvZYyx/3A+0PYP8WZ9QcNHQaiFooXo+IELaIF/86dMx3jouQzyLaiLss/DYfGb", + "openid2ticket_oPGiXjhP6KzS5g8fMV3OHuuZkwmg": "" +} + + +def execute(begin_openid, begin_create_time): + params = { + "action": "get_user_list", + "groupid": -2, + "begin_openid": begin_openid, + "begin_create_time": begin_create_time, + "limit": 20, + "offset": 0, + "backfoward": 1, + "token": 95651471, + "lang": "zh_CN", + "f": "json", + "ajax": 1, + "random": 0.6784559357687705, + } + + headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36", + "HOST": "mp.weixin.qq.com", + "Cookie": "appmsglist_action_2393828411=card; appmsglist_action_2397322000=card; appmsglist_action_2393291452=card; noticeLoginFlag=1; remember_acct=lzjun567%40gmail.com; pgv_pvid=5422600736; RK=FAIdRbY8Hq; ptcz=f284ef07e30510ca4de096c3a2c609c24239ce649730ff32922337bcbc96c62c; tvfe_boss_uuid=eda94597299f6f90; o_cookie=253421576; pac_uid=1_253421576; _ga=GA1.2.11487159.1587366826; iip=0; pt_sms_phone=158******20; wxuin=03951858983307; openid2ticket_o8uaO6kKiXBtnsUlETb2A4RtJpp4=; UM_distinctid=17944bc50b4c-0cf5c1c972f9ea-3f356b-1fa400-17944bc50b52c2; eas_sid=W1B6e2c1P3o2s825h7L449n642; mm_lang=zh_CN; CNZZDATA1272960370=1269357260-1592369408-https%253A%252F%252Fmp.weixin.qq.com%252F%7C1624334587; CNZZDATA1272425418=1699923129-1592372262-https%253A%252F%252Fmp.weixin.qq.com%252F%7C1624333219; ua_id=8vO2bkcLMNeldl9JAAAAAARMJnerzvqXqrhZO5-2ZL4=; _tc_unionid=28741bd1-95d8-4004-b608-c93597a49688; noticeLoginFlag=1; __root_domain_v=.weixin.qq.com; _qddaz=QD.685431855347487; ptui_loginuin=253421576; openid2ticket_om422jrdTnEAB1r7-zXTmKubGER0=2IFQ/MFb3NNLzCUhgt0XKtzFcJJn6Qcf2SxemWCxzQo=; rewardsn=; wxtokenkey=777; cert=flxHAVShHHKtsHaGR2XZN3VDKjjekUsh; remember_acct=253421576%40qq.com; openid2ticket_ow-uujmHSiUtZWYpm7jDnwkAnt44=/KeBMKI0fyiYdbdwzphNtjjfOxVPcdGjKN+jBKfBCtg=; openid2ticket_oPGiXjhP6KzS5g8fMV3OHuuZkwmg=8gHgxo/ylpS6dCkv7OOeAmDGnZrSMHxE1PLqHS51CEg=; uuid=996152af21663eeaf1716f6d056cd573; rand_info=CAESINIiq2GeUQvsMzW7aoZgT4PyCe/bXGkX6ICCnqvhR4sn; slave_bizuin=3579961954; data_bizuin=3579961954; bizuin=3579961954; data_ticket=SDKlNn7nRnZ6d5Zz9ug6EhgEBY7rYZg6ydm5KdrncdR9rMuP1YmWzwyXqEKW/1J9; slave_sid=VUxRbjBMVWhRTlVUeVh4Z2JHVXM2TDR1RlVmR01kQkZjcVJzUVY3YWRGYTFhYzdaclNyMFBlTURVcFVrTHF1SHRXazZtQmFfVldRek1JTU9sS01HbEZYNUY4enZhVnNqVFBKUlF4TEZnQUJlbm5LdERKOFlPZEozWWFUelg2UzU4MEdHTEtrRHZ6MTVHaGsx; slave_user=gh_a0467681d76f; xid=d6cbe1d708f0d720a5cae0ff84b94e68" + } + res = requests.get(url, params=params, headers=headers) + pprint.pprint(res.json()) + return res.json().get("user_list").get("user_info_list") + + +with open( + "公众号关注用户表10_28.csv", + 'w', + encoding="utf8", + newline="") as csvfile: + writer = csv.DictWriter(csvfile, field_order, dialect='myDialect') + writer.writeheader() + + # 第二页的起始ID + begin_openid = "oYuJh1WSIFbLZBFCQO6Jz5Bimbxo" + begin_create_time = 1635423536 + + data = execute(begin_openid, begin_create_time) + while data: + import time + + time.sleep(1) + for item in data: + begin_create_time = user_create_time = item.get("user_create_time") + begin_openid = item.get("user_openid") + import datetime + + time = datetime.datetime.fromtimestamp(user_create_time).strftime("'%Y-%m-%d %H:%M:%S'") + writer.writerow(dict(zip(field_order, + [item.get("user_name").replace("\t", "").replace(",", ""), + time, + item.get("user_head_img")]))) + + data = execute(begin_openid, begin_create_time) diff --git a/haodf/20211115164636.xlsx b/haodf/20211115164636.xlsx new file mode 100644 index 0000000..ae98874 Binary files /dev/null and b/haodf/20211115164636.xlsx differ diff --git a/haodf/20211115164930.xlsx b/haodf/20211115164930.xlsx new file mode 100644 index 0000000..3f0a7dc Binary files /dev/null and b/haodf/20211115164930.xlsx differ diff --git a/haodf/20211115165307.xlsx b/haodf/20211115165307.xlsx new file mode 100644 index 0000000..f109025 Binary files /dev/null and b/haodf/20211115165307.xlsx differ diff --git a/haodf/__init__.py b/haodf/__init__.py new file mode 100644 index 0000000..bca5cfc --- /dev/null +++ b/haodf/__init__.py @@ -0,0 +1,107 @@ +import datetime +import logging +import os +import time +from logging.handlers import TimedRotatingFileHandler + +import xlsxwriter +from selenium import webdriver + +basedir = os.path.abspath(os.path.dirname(__file__)) +logger = logging.getLogger(__file__) +logger.setLevel(logging.INFO) +# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') +file_handler = TimedRotatingFileHandler(os.path.join(basedir, 'crawler.log'), when="D", interval=1, + backupCount=10, encoding='utf-8') +# file_handler.setFormatter(formatter) +file_handler.setLevel(logging.INFO) +logger.addHandler(file_handler) + +console = logging.StreamHandler() +console.setLevel(logging.DEBUG) +logger.addHandler(console) + +chrome_opt = webdriver.ChromeOptions() +# prefs = {"profile.managed_default_content_settings.images": 2} +# chrome_opt.add_experimental_option("prefs", prefs) + + +if os.name == 'posix': + driver = webdriver.Chrome(executable_path="/Users/wuchangfang/Downloads/chromedriver", + options=chrome_opt) +else: + driver = webdriver.Chrome(executable_path="C:/ProgramData/chromedriver_win32/chromedriver.exe", + ) + +driver.set_window_position(-10, 0) + +file_name = f'{datetime.datetime.now().strftime("%Y%m%d%H%M%S")}.xlsx' +workbook = xlsxwriter.Workbook(file_name) +worksheet = workbook.add_worksheet("数据") +bold = workbook.add_format({'bold': True}) +worksheet.write('A1', '名字', bold) +worksheet.write('B1', '职称', bold) +worksheet.write('C1', '医院', bold) +worksheet.write('D1', '科室', bold) +worksheet.write('E1', '擅长', bold) +worksheet.write("F1", "疗效", bold) +worksheet.write('G1', '态度', bold) +row = 1 + + +def login(): + row = 1 + for i in range(1, 201): + url = f"https://www.haodf.com/doctor/list-all-xinlizixunke.html?p={i}" + driver.get(url) + time.sleep(1) + # 找到 医生列表的ul + # driver.find_element_by_xpath("/html/body/div[3]/div/div[1]/div[2]/ul") + elements = driver.find_elements_by_class_name("js-fam-doc-li") + for element in elements: + name = element.find_element_by_class_name("doc-name").text + print(name) + zhicheng = element.find_element_by_class_name("ml15").text + print(zhicheng) + hospital = element.find_element_by_class_name("mt5").text + department = element.find_element_by_class_name("mt5").find_element_by_class_name("ml5").text + print(department) + hospital = hospital.replace(department, "") + print(hospital) + good_at = element.find_element_by_class_name("doc-speciaty").text.replace("擅长: ", "") + print(good_at) + + taidu = element.find_element_by_class_name("taidu").text.replace("态度:\n", "") + print(taidu) + liaoxiao = element.find_element_by_class_name("liaoxiao").text.replace("疗效:\n", "") + print(liaoxiao) + worksheet.write(row, 0, name) + worksheet.write(row, 1, zhicheng) + worksheet.write(row, 2, hospital) + worksheet.write(row, 3, department) + worksheet.write(row, 4, good_at) + worksheet.write(row, 5, liaoxiao) + worksheet.write(row, 6, taidu) + row += 1 + + # driver.find_element_by_xpath("/html/body/div[2]/div/div[1]/div[1]/div[2]").click() + # + # driver.find_element_by_id("account_input").send_keys("nr_9l85370p7") + # driver.find_element_by_id("password_input").send_keys("854976") + # time.sleep(1) + # driver.find_element_by_xpath('//*[@id="pwd_confirm"]').click() + # driver.find_element_by_xpath('//*[@id="zhou-bang"]').click() + import random + time.sleep(random.choice(range(1, 10))) + workbook.close() + + +if __name__ == '__main__': + try: + login() + # update_username_by_nickname("vttalk") + driver.close() + except Exception as e: + import traceback + + traceback.print_exc() diff --git a/mp4_to_gif/demo.mp4 b/mp4_to_gif/demo.mp4 new file mode 100644 index 0000000..49c7476 Binary files /dev/null and b/mp4_to_gif/demo.mp4 differ diff --git a/mp4_to_gif/mp4_to_gif.py b/mp4_to_gif/mp4_to_gif.py new file mode 100644 index 0000000..463314a --- /dev/null +++ b/mp4_to_gif/mp4_to_gif.py @@ -0,0 +1,49 @@ +import glob +from moviepy.editor import * +import cv2 +from PIL import Image + + +def convert_mp4_to_jpgs(input_file): + # 先将mp4文件的所有帧读取出保存为图片 + video_capture = cv2.VideoCapture(input_file) + still_reading, image = video_capture.read() + frame_count = 0 + while still_reading: + cv2.imwrite(f"output/frame_{frame_count:03d}.jpg", image) + # read next image + still_reading, image = video_capture.read() + frame_count += 1 + + +def convert_images_to_gif(output_file): + # 读取目录下图片,用Pillow模块的Image和所有图片合并 + # 成一张gif + images = glob.glob(f"output/*.jpg") + images.sort() + frames = [Image.open(image) for image in images] + frame_one = frames[0] + frame_one.save(output_file, format="GIF", append_images=[f for i, f in enumerate(frames[1:]) if i % 2 == 0], + save_all=True, duration=40, loop=0) + + +def convert_mp4_to_gif(input_file, output_file): + convert_mp4_to_jpgs(input_file) + convert_images_to_gif(output_file) + + +def mp4_to_gif2(): + + clip = VideoFileClip("demo.mp4") + clip.write_gif("output2.gif") + + +if __name__ == "__main__": + mp4_to_gif2() + # convert_mp4_to_gif("demo.mp4", "output2.gif") + + +def convert_gif_to_mp4(): + import moviepy.editor as mp + clip = mp.VideoFileClip("demo.gif") + clip.write_videofile("output.mp4") diff --git a/mp4_to_gif/output.gif b/mp4_to_gif/output.gif new file mode 100644 index 0000000..5470392 Binary files /dev/null and b/mp4_to_gif/output.gif differ diff --git a/mp4_to_gif/output/frame_000.jpg b/mp4_to_gif/output/frame_000.jpg new file mode 100644 index 0000000..feb9b8e Binary files /dev/null and b/mp4_to_gif/output/frame_000.jpg differ diff --git a/mp4_to_gif/output/frame_001.jpg b/mp4_to_gif/output/frame_001.jpg new file mode 100644 index 0000000..f2840a4 Binary files /dev/null and b/mp4_to_gif/output/frame_001.jpg differ diff --git a/mp4_to_gif/output/frame_002.jpg b/mp4_to_gif/output/frame_002.jpg new file mode 100644 index 0000000..4f5a29b Binary files /dev/null and b/mp4_to_gif/output/frame_002.jpg differ diff --git a/mp4_to_gif/output/frame_003.jpg b/mp4_to_gif/output/frame_003.jpg new file mode 100644 index 0000000..fd9ff31 Binary files /dev/null and b/mp4_to_gif/output/frame_003.jpg differ diff --git a/mp4_to_gif/output/frame_004.jpg b/mp4_to_gif/output/frame_004.jpg new file mode 100644 index 0000000..1141d73 Binary files /dev/null and b/mp4_to_gif/output/frame_004.jpg differ diff --git a/mp4_to_gif/output/frame_005.jpg b/mp4_to_gif/output/frame_005.jpg new file mode 100644 index 0000000..fc0c09e Binary files /dev/null and b/mp4_to_gif/output/frame_005.jpg differ diff --git a/mp4_to_gif/output/frame_006.jpg b/mp4_to_gif/output/frame_006.jpg new file mode 100644 index 0000000..0a48f68 Binary files /dev/null and b/mp4_to_gif/output/frame_006.jpg differ diff --git a/mp4_to_gif/output/frame_007.jpg b/mp4_to_gif/output/frame_007.jpg new file mode 100644 index 0000000..9837621 Binary files /dev/null and b/mp4_to_gif/output/frame_007.jpg differ diff --git a/mp4_to_gif/output/frame_008.jpg b/mp4_to_gif/output/frame_008.jpg new file mode 100644 index 0000000..bd7f870 Binary files /dev/null and b/mp4_to_gif/output/frame_008.jpg differ diff --git a/mp4_to_gif/output/frame_009.jpg b/mp4_to_gif/output/frame_009.jpg new file mode 100644 index 0000000..87f5912 Binary files /dev/null and b/mp4_to_gif/output/frame_009.jpg differ diff --git a/mp4_to_gif/output/frame_010.jpg b/mp4_to_gif/output/frame_010.jpg new file mode 100644 index 0000000..fe74293 Binary files /dev/null and b/mp4_to_gif/output/frame_010.jpg differ diff --git a/mp4_to_gif/output/frame_011.jpg b/mp4_to_gif/output/frame_011.jpg new file mode 100644 index 0000000..fb1fcbf Binary files /dev/null and b/mp4_to_gif/output/frame_011.jpg differ diff --git a/mp4_to_gif/output/frame_012.jpg b/mp4_to_gif/output/frame_012.jpg new file mode 100644 index 0000000..842323d Binary files /dev/null and b/mp4_to_gif/output/frame_012.jpg differ diff --git a/mp4_to_gif/output/frame_013.jpg b/mp4_to_gif/output/frame_013.jpg new file mode 100644 index 0000000..b9084ce Binary files /dev/null and b/mp4_to_gif/output/frame_013.jpg differ diff --git a/mp4_to_gif/output/frame_014.jpg b/mp4_to_gif/output/frame_014.jpg new file mode 100644 index 0000000..855e42a Binary files /dev/null and b/mp4_to_gif/output/frame_014.jpg differ diff --git a/mp4_to_gif/output/frame_015.jpg b/mp4_to_gif/output/frame_015.jpg new file mode 100644 index 0000000..d0f01ea Binary files /dev/null and b/mp4_to_gif/output/frame_015.jpg differ diff --git a/mp4_to_gif/output/frame_016.jpg b/mp4_to_gif/output/frame_016.jpg new file mode 100644 index 0000000..e4b9024 Binary files /dev/null and b/mp4_to_gif/output/frame_016.jpg differ diff --git a/mp4_to_gif/output/frame_017.jpg b/mp4_to_gif/output/frame_017.jpg new file mode 100644 index 0000000..a4afa3e Binary files /dev/null and b/mp4_to_gif/output/frame_017.jpg differ diff --git a/mp4_to_gif/output/frame_018.jpg b/mp4_to_gif/output/frame_018.jpg new file mode 100644 index 0000000..f84af43 Binary files /dev/null and b/mp4_to_gif/output/frame_018.jpg differ diff --git a/mp4_to_gif/output/frame_019.jpg b/mp4_to_gif/output/frame_019.jpg new file mode 100644 index 0000000..2601a3a Binary files /dev/null and b/mp4_to_gif/output/frame_019.jpg differ diff --git a/mp4_to_gif/output/frame_020.jpg b/mp4_to_gif/output/frame_020.jpg new file mode 100644 index 0000000..19f12ef Binary files /dev/null and b/mp4_to_gif/output/frame_020.jpg differ diff --git a/mp4_to_gif/output/frame_021.jpg b/mp4_to_gif/output/frame_021.jpg new file mode 100644 index 0000000..73f0a9e Binary files /dev/null and b/mp4_to_gif/output/frame_021.jpg differ diff --git a/mp4_to_gif/output/frame_022.jpg b/mp4_to_gif/output/frame_022.jpg new file mode 100644 index 0000000..764f9c6 Binary files /dev/null and b/mp4_to_gif/output/frame_022.jpg differ diff --git a/mp4_to_gif/output/frame_023.jpg b/mp4_to_gif/output/frame_023.jpg new file mode 100644 index 0000000..e82bc8e Binary files /dev/null and b/mp4_to_gif/output/frame_023.jpg differ diff --git a/mp4_to_gif/output/frame_024.jpg b/mp4_to_gif/output/frame_024.jpg new file mode 100644 index 0000000..a636a2b Binary files /dev/null and b/mp4_to_gif/output/frame_024.jpg differ diff --git a/mp4_to_gif/output/frame_025.jpg b/mp4_to_gif/output/frame_025.jpg new file mode 100644 index 0000000..66e36eb Binary files /dev/null and b/mp4_to_gif/output/frame_025.jpg differ diff --git a/mp4_to_gif/output/frame_026.jpg b/mp4_to_gif/output/frame_026.jpg new file mode 100644 index 0000000..bb26260 Binary files /dev/null and b/mp4_to_gif/output/frame_026.jpg differ diff --git a/mp4_to_gif/output/frame_027.jpg b/mp4_to_gif/output/frame_027.jpg new file mode 100644 index 0000000..bede1c9 Binary files /dev/null and b/mp4_to_gif/output/frame_027.jpg differ diff --git a/mp4_to_gif/output/frame_028.jpg b/mp4_to_gif/output/frame_028.jpg new file mode 100644 index 0000000..8df4c29 Binary files /dev/null and b/mp4_to_gif/output/frame_028.jpg differ diff --git a/mp4_to_gif/output/frame_029.jpg b/mp4_to_gif/output/frame_029.jpg new file mode 100644 index 0000000..3d7cea1 Binary files /dev/null and b/mp4_to_gif/output/frame_029.jpg differ diff --git a/mp4_to_gif/output/frame_030.jpg b/mp4_to_gif/output/frame_030.jpg new file mode 100644 index 0000000..821a2c3 Binary files /dev/null and b/mp4_to_gif/output/frame_030.jpg differ diff --git a/mp4_to_gif/output/frame_031.jpg b/mp4_to_gif/output/frame_031.jpg new file mode 100644 index 0000000..ad924a9 Binary files /dev/null and b/mp4_to_gif/output/frame_031.jpg differ diff --git a/mp4_to_gif/output/frame_032.jpg b/mp4_to_gif/output/frame_032.jpg new file mode 100644 index 0000000..25c5582 Binary files /dev/null and b/mp4_to_gif/output/frame_032.jpg differ diff --git a/mp4_to_gif/output/frame_033.jpg b/mp4_to_gif/output/frame_033.jpg new file mode 100644 index 0000000..f507679 Binary files /dev/null and b/mp4_to_gif/output/frame_033.jpg differ diff --git a/mp4_to_gif/output/frame_034.jpg b/mp4_to_gif/output/frame_034.jpg new file mode 100644 index 0000000..2eeb50f Binary files /dev/null and b/mp4_to_gif/output/frame_034.jpg differ diff --git a/mp4_to_gif/output/frame_035.jpg b/mp4_to_gif/output/frame_035.jpg new file mode 100644 index 0000000..d65f1d2 Binary files /dev/null and b/mp4_to_gif/output/frame_035.jpg differ diff --git a/mp4_to_gif/output/frame_036.jpg b/mp4_to_gif/output/frame_036.jpg new file mode 100644 index 0000000..2ad2557 Binary files /dev/null and b/mp4_to_gif/output/frame_036.jpg differ diff --git a/mp4_to_gif/output/frame_037.jpg b/mp4_to_gif/output/frame_037.jpg new file mode 100644 index 0000000..c32cbc9 Binary files /dev/null and b/mp4_to_gif/output/frame_037.jpg differ diff --git a/mp4_to_gif/output/frame_038.jpg b/mp4_to_gif/output/frame_038.jpg new file mode 100644 index 0000000..e36ad72 Binary files /dev/null and b/mp4_to_gif/output/frame_038.jpg differ diff --git a/mp4_to_gif/output/frame_039.jpg b/mp4_to_gif/output/frame_039.jpg new file mode 100644 index 0000000..34a157c Binary files /dev/null and b/mp4_to_gif/output/frame_039.jpg differ diff --git a/mp4_to_gif/output/frame_040.jpg b/mp4_to_gif/output/frame_040.jpg new file mode 100644 index 0000000..304632c Binary files /dev/null and b/mp4_to_gif/output/frame_040.jpg differ diff --git a/mp4_to_gif/output/frame_041.jpg b/mp4_to_gif/output/frame_041.jpg new file mode 100644 index 0000000..f7c1611 Binary files /dev/null and b/mp4_to_gif/output/frame_041.jpg differ diff --git a/mp4_to_gif/output/frame_042.jpg b/mp4_to_gif/output/frame_042.jpg new file mode 100644 index 0000000..179ea23 Binary files /dev/null and b/mp4_to_gif/output/frame_042.jpg differ diff --git a/mp4_to_gif/output/frame_043.jpg b/mp4_to_gif/output/frame_043.jpg new file mode 100644 index 0000000..1a09a73 Binary files /dev/null and b/mp4_to_gif/output/frame_043.jpg differ diff --git a/mp4_to_gif/output/frame_044.jpg b/mp4_to_gif/output/frame_044.jpg new file mode 100644 index 0000000..d85a3a3 Binary files /dev/null and b/mp4_to_gif/output/frame_044.jpg differ diff --git a/mp4_to_gif/output/frame_045.jpg b/mp4_to_gif/output/frame_045.jpg new file mode 100644 index 0000000..6e5953c Binary files /dev/null and b/mp4_to_gif/output/frame_045.jpg differ diff --git a/mp4_to_gif/output/frame_046.jpg b/mp4_to_gif/output/frame_046.jpg new file mode 100644 index 0000000..10c7bfb Binary files /dev/null and b/mp4_to_gif/output/frame_046.jpg differ diff --git a/mp4_to_gif/output/frame_047.jpg b/mp4_to_gif/output/frame_047.jpg new file mode 100644 index 0000000..5f185c8 Binary files /dev/null and b/mp4_to_gif/output/frame_047.jpg differ diff --git a/mp4_to_gif/output/frame_048.jpg b/mp4_to_gif/output/frame_048.jpg new file mode 100644 index 0000000..ad6473d Binary files /dev/null and b/mp4_to_gif/output/frame_048.jpg differ diff --git a/mp4_to_gif/output/frame_049.jpg b/mp4_to_gif/output/frame_049.jpg new file mode 100644 index 0000000..a4a2322 Binary files /dev/null and b/mp4_to_gif/output/frame_049.jpg differ diff --git a/mp4_to_gif/output/frame_050.jpg b/mp4_to_gif/output/frame_050.jpg new file mode 100644 index 0000000..1e5f9c6 Binary files /dev/null and b/mp4_to_gif/output/frame_050.jpg differ diff --git a/mp4_to_gif/output/frame_051.jpg b/mp4_to_gif/output/frame_051.jpg new file mode 100644 index 0000000..078031f Binary files /dev/null and b/mp4_to_gif/output/frame_051.jpg differ diff --git a/mp4_to_gif/output/frame_052.jpg b/mp4_to_gif/output/frame_052.jpg new file mode 100644 index 0000000..77e56d3 Binary files /dev/null and b/mp4_to_gif/output/frame_052.jpg differ diff --git a/mp4_to_gif/output/frame_053.jpg b/mp4_to_gif/output/frame_053.jpg new file mode 100644 index 0000000..3f5edeb Binary files /dev/null and b/mp4_to_gif/output/frame_053.jpg differ diff --git a/mp4_to_gif/output/frame_054.jpg b/mp4_to_gif/output/frame_054.jpg new file mode 100644 index 0000000..dbe58b6 Binary files /dev/null and b/mp4_to_gif/output/frame_054.jpg differ diff --git a/mp4_to_gif/output/frame_055.jpg b/mp4_to_gif/output/frame_055.jpg new file mode 100644 index 0000000..ec48f3b Binary files /dev/null and b/mp4_to_gif/output/frame_055.jpg differ diff --git a/mp4_to_gif/output/frame_056.jpg b/mp4_to_gif/output/frame_056.jpg new file mode 100644 index 0000000..b301314 Binary files /dev/null and b/mp4_to_gif/output/frame_056.jpg differ diff --git a/mp4_to_gif/output/frame_057.jpg b/mp4_to_gif/output/frame_057.jpg new file mode 100644 index 0000000..ac4b9e9 Binary files /dev/null and b/mp4_to_gif/output/frame_057.jpg differ diff --git a/mp4_to_gif/output/frame_058.jpg b/mp4_to_gif/output/frame_058.jpg new file mode 100644 index 0000000..f878047 Binary files /dev/null and b/mp4_to_gif/output/frame_058.jpg differ diff --git a/mp4_to_gif/output/frame_059.jpg b/mp4_to_gif/output/frame_059.jpg new file mode 100644 index 0000000..eb6b983 Binary files /dev/null and b/mp4_to_gif/output/frame_059.jpg differ diff --git a/mp4_to_gif/output/frame_060.jpg b/mp4_to_gif/output/frame_060.jpg new file mode 100644 index 0000000..b8eed00 Binary files /dev/null and b/mp4_to_gif/output/frame_060.jpg differ diff --git a/mp4_to_gif/output2.gif b/mp4_to_gif/output2.gif new file mode 100644 index 0000000..72075a6 Binary files /dev/null and b/mp4_to_gif/output2.gif differ diff --git a/test.py b/test.py new file mode 100644 index 0000000..550d4b8 --- /dev/null +++ b/test.py @@ -0,0 +1,15 @@ +import requests + +url = "http://210.1.227.58:9001/api/setcallback.php" + +payload = "{\"wid\": \"33758168184\", \"callback_url\": \"http://43.153.104.20:5000/api/callback\"}" +headers = { + 'content-type': "application/json", + 'cache-control': "no-cache", + 'postman-token': "c59c7e50-06e8-c3a0-6090-2f9861e7e03d" + } + +response = requests.request("POST", url, data=payload, headers=headers) + +print(response.status_code) +print(response.text) \ No newline at end of file diff --git "a/\345\233\275\346\227\227\345\244\264\345\203\217.zip" "b/\345\233\275\346\227\227\345\244\264\345\203\217.zip" new file mode 100644 index 0000000..b346bc6 Binary files /dev/null and "b/\345\233\275\346\227\227\345\244\264\345\203\217.zip" differ