Skip to content

Commit 2fdc8d3

Browse files
committed
day12
1 parent 6b2a52c commit 2fdc8d3

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

19100401/congboqiu/d12/main.py

+14-21
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
11
import re
22
import jieba
33
import getpass
4-
import yagmail
5-
import stats_word
4+
import requests
5+
from pyquery import PyQuery
6+
from mymodule import stats_word
67

78
#导入模块wxpy,建微信机器人
89
import sys
910
sys.path.append('c:\\users\\win10\\appdata\\local\\programs\\python\\python37\\lib\\site-packages')
1011
from wxpy import *
11-
bot=wxpy.Bot(cache_path=True)
12-
myself=bot.self#机器人自身作为一个聊天对象
13-
14-
#获取聊天对象
15-
#bot.self.add()#微信中把自己加为好友
16-
#bot.self.accept()
17-
#bot.file_helper.send('hello from bobohu!')#发消息给文件助手
18-
#bot.add_friend('上山虎',verify_content='你好')#加朋友
19-
#bot.accept_friend('上山虎',verify_content='你好')
20-
#my_friend.send('你好,很高兴认识你。')#发消息给朋友
12+
bot=Bot(cache_path=True)
2113
my_friend=bot.friends().search('翕羊羊')[0]
22-
@bot.register()
23-
def print_others(msg)
24-
print(msg)
14+
my_friend.send('你好,请分享篇文章给我')#发消息给朋友
15+
2516
@bot.register(my_friend,msg_types='Sharing')
2617
def auto_reply(msg):
27-
response = requests.get(msg.url)
18+
print(msg)
19+
print(msg.url)
20+
response = requests.get("msg.url")
2821
document = PyQuery(response.text)
2922
content = document('#js_content').text()
23+
print(content)
3024
text=content
31-
print(text)
32-
str_text=str(stats_word.stats_text(text,100))
33-
return my_friend.send('str_text')
34-
35-
wxpy.embed()
25+
str_text=str(stats_word.stats_text_cn(text,100))
26+
my_friend.send(str_text)
27+
return auto_reply()
28+
embed()
3629

wxpy.pkl

442 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)