File tree 2 files changed +14
-21
lines changed
2 files changed +14
-21
lines changed Original file line number Diff line number Diff line change 1
1
import re
2
2
import jieba
3
3
import getpass
4
- import yagmail
5
- import stats_word
4
+ import requests
5
+ from pyquery import PyQuery
6
+ from mymodule import stats_word
6
7
7
8
#导入模块wxpy,建微信机器人
8
9
import sys
9
10
sys .path .append ('c:\\ users\\ win10\\ appdata\\ local\\ programs\\ python\\ python37\\ lib\\ site-packages' )
10
11
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 )
21
13
my_friend = bot .friends ().search ('翕羊羊' )[0 ]
22
- @bot .register ()
23
- def print_others (msg )
24
- print (msg )
14
+ my_friend .send ('你好,请分享篇文章给我' )#发消息给朋友
15
+
25
16
@bot .register (my_friend ,msg_types = 'Sharing' )
26
17
def auto_reply (msg ):
27
- response = requests .get (msg .url )
18
+ print (msg )
19
+ print (msg .url )
20
+ response = requests .get ("msg.url" )
28
21
document = PyQuery (response .text )
29
22
content = document ('#js_content' ).text ()
23
+ print (content )
30
24
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 ()
36
29
You can’t perform that action at this time.
0 commit comments