-
Notifications
You must be signed in to change notification settings - Fork 0
/
2019-01-05-8.html
174 lines (146 loc) · 40.7 KB
/
2019-01-05-8.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
<meta content="yes" name="apple-mobile-web-app-capable"/>
<meta content="black" name="apple-mobile-web-app-status-bar-style"/>
<meta content="telephone=no" name="format-detection"/>
<meta name="renderer" content="webkit"/>
<title>用python实现微信消息防撤回</title>
<link rel="stylesheet" href="data:text/css;base64,CiAgICBoMSwgaDIsIGgzLCBoNSwgaDYsICBpbWcsIHN2ZywgcHJlLCB0YWJsZSwgdHIsIC5tZF9saW5le3BhZ2UtYnJlYWstaW5zaWRlOiBhdm9pZH0KCgogICAgYm9keSB7CiAgICAgICAgYmFja2dyb3VuZDogI0ZGRkZGRjsKICAgICAgICBmb250LXNpemU6IDE0cHg7CiAgICAgICAgbGluZS1oZWlnaHQ6Mi4zOwogICAgICAgIGZvbnQtZmFtaWx5OiAiQXBwbGUgU0QgR290aGljIE5lbyI7CiAgICAgICAgZm9udC13ZWlnaHQ6IG5vcm1hbDsKICAgICAgICBjb2xvcjogIzNDM0MzQzsKICAgICAgICBwYWRkaW5nOiAwIDM4cHg7CiAgICAgICAgbWF4LXdpZHRoOiA4MjBweDsKICAgICAgICBtYXJnaW46IDAgYXV0bzsKCiAgICAgICAgd29yZC13cmFwOmJyZWFrLXdvcmQ7CiAgICAgICAgd29yZC1icmVhazogbm9ybWFsOwogICAgICAgIG92ZXJmbG93LXdyYXA6YnJlYWstd29yZDsKCgogICAgICAgIG92ZXJmbG93LXg6IGhpZGRlbjsKICAgICAgICB0ZXh0LXJlbmRlcmluZzogb3B0aW1pemVMZWdpYmlsaXR5OwogICAgICAgIC13ZWJraXQtdGV4dC1zaXplLWFkanVzdDogbm9uZTsKICAgIH0KCiAgICBicnsKICAgICAgICBsaW5lLWhlaWdodDogMi4zOwogICAgfQoKCgogICAgQG1lZGlhIChtYXgtd2lkdGg6IDYwMHB4KSB7CiAgICAgICAgYm9keXsKICAgICAgICAgICAgcGFkZGluZzogMCAzMHB4OwogICAgICAgIH0KICAgIH0KCiAgICBAbWVkaWEgKG1heC13aWR0aDogNDgwcHgpIHsKICAgICAgICBib2R5ewogICAgICAgICAgICBwYWRkaW5nOiAwIDIwcHg7CiAgICAgICAgfQogICAgfQoKICAgIC5naXN0ewogICAgICAgIHdvcmQtYnJlYWs6IG5vcm1hbDsKICAgIH0KCiAgICAucG9zdHsKICAgICAgICBtYXJnaW4tdG9wOiAxMHB4OwogICAgICAgIG1hcmdpbi1ib3R0b206IDUwcHg7CiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlOwogICAgfQoKCgogICAgaW1newogICAgICAgIG1heC13aWR0aDogOTglOwogICAgICAgIG1hcmdpbjogMC44ZW0gYXV0byAwLjhlbSBhdXRvOwogICAgfQoKICAgIGgxIGltZywgaDIgaW1nLCBoMyBpbWcsIGg0IGltZywgaDUgaW1nLCBoNiBpbWd7CiAgICAgICAgbWFyZ2luOiBhdXRvOwogICAgfQoKICAgIC54Ml9pbWFnZXsKICAgICAgICB6b29tOiA1MCU7CiAgICB9CgogICAgLngzX2ltYWdlewogICAgICAgIHpvb206IDMzLjMzJTsKICAgIH0KCiAgICAueDRfaW1hZ2V7CiAgICAgICAgem9vbTogMjUlOwogICAgfQoKCiAgICBwIGltZ3sKICAgICAgICBtYXJnaW46IDAgYXV0bzsKICAgIH0KCiAgICBwewogICAgICAgIC8qb3ZlcmZsb3c6aGlkZGVuOyovCiAgICAgICAgbWFyZ2luOiAxLjBlbSAwIDEuOGVtIDA7CiAgICB9CgogICAgcC5tZF9ibG9ja19hc19vcGVuaW5newogICAgICAgIG1hcmdpbi1ib3R0b206IC0wLjVlbSAhaW1wb3J0YW50OwogICAgfQoKICAgIGxpIHB7CiAgICAgICAgbGluZS1oZWlnaHQ6IDIuMDc7CiAgICAgICAgbWFyZ2luOiAwOwogICAgfQoKICAgIC5wX3BhcnQgewogICAgICAgIG1hcmdpbjogMTBweCAwOwogICAgfQoKICAgIC5wX3BhcnQgcHsKICAgICAgICBtYXJnaW46IDAgMCAwLjZlbSAwOwogICAgfQoKICAgIC8qIHRleHQgaW5kZW50IGZvciBjaGluZXNlIHN0YXJ0cyovCiAgICAvKmgyLCBoMywgaDQsIGg1LCBoNiwgLnBfcGFydCBwLCAudG9kb19pdGVtLCBwewogICAgICAgIHRleHQtaW5kZW50OiAwcHg7CiAgICB9Ki8KICAgIHRhYmxlLCBwcmUsIHN2ZywgLmNvZGVoaWxpdGV0YWJsZXsKICAgICAgICBtYXJnaW4tbGVmdDogMHB4OwogICAgICAgIG1hcmdpbi1yaWdodDogMHB4OwogICAgfQoKICAgIC5jb2RlaGlsaXRldGFibGUgcHJlewogICAgICAgIG1hcmdpbi1sZWZ0OiAwOwogICAgICAgIG1hcmdpbi1yaWdodDogMDsKCiAgICB9CgogICAgLmNvZGVoaWxpdGV0YWJsZSAuY29kZWhpbGl0ZSBwcmV7CiAgICAgICAgYm9yZGVyLWxlZnQ6IG5vbmU7CiAgICB9CgogICAgLyogdGV4dCBpbmRlbnQgZm9yIGNoaW5lc2UgZW5kcyovCgoKICAgIGJsb2NrcXVvdGUgLnBfcGFydCBwLCBsaSAucF9wYXJ0IHB7CiAgICAgICAgdGV4dC1pbmRlbnQ6IDAgIWltcG9ydGFudDsKICAgIH0KCgogICAgaHJ7CiAgICAgICAgbWFyZ2luOiAzOHB4IDA7CiAgICAgICAgYm9yZGVyOiBub25lOwogICAgICAgIGJvcmRlci1ib3R0b206IDFweCBkYXNoZWQgcmdiYSgyMDUsIDIwNSwgMjA1LCAwLjM1KTsKICAgICAgICBjb2xvcjogcmdiYSgyMDUsIDIwNSwgMjA1LCAwLjM1KTsKICAgICAgICBoZWlnaHQ6IDFweDsKICAgICAgICBsaW5lLWhlaWdodDoxcHg7CiAgICAgICAgZm9udC1zaXplOjFweDsKICAgICAgICBvdmVyZmxvdy15OiBoaWRkZW47CiAgICB9CgoKICAgIGgxewogICAgICAgIGNvbG9yOiAjMTBBM0VFOwogICAgICAgIGZvbnQtc2l6ZTogMS42ZW07CiAgICAgICAgdGV4dC1hbGlnbjogbGVmdDsKICAgICAgICBtYXJnaW46IDA7CiAgICAgICAgcGFkZGluZzogMDsKICAgICAgICBsaW5lLWhlaWdodDogMS42ZW07CiAgICAgICAgbWFyZ2luLXRvcDogMC44ZW07CiAgICAgICAgbWFyZ2luLWJvdHRvbTogMC42ZW07CiAgICB9CgogICAgaDEsIGgyLCBoMywgaDR7CiAgICAgICAgY29sb3I6ICMxMEEzRUU7CiAgICB9CgoKICAgIGgyLCBoM3sKICAgICAgICBsaW5lLWhlaWdodDogMS41ZW07CiAgICAgICAgbWFyZ2luLXRvcDogMS44ZW07CiAgICAgICAgbWFyZ2luLWJvdHRvbTogMC41ZW07CiAgICB9CgogICAgLmgxNi5tZF9maXJzdF9oLm1kX2ZpcnN0X3BhcnQgewogICAgICAgIG1hcmdpbi10b3A6IDVweDsKICAgIH0KCiAgICBoMiB7CiAgICAgICAgZm9udC1zaXplOiAxLjM1ZW07CiAgICB9CgogICAgaDMgewogICAgICAgIGZvbnQtc2l6ZTogMS4yZW0KICAgIH0KCiAgICBoNCB7CiAgICAgICAgZm9udC1zaXplOiAxLjFlbTsKICAgIH0KCiAgICBoNSB7CiAgICAgICAgZm9udC1zaXplOiAxLjE1ZW07CiAgICB9CgogICAgaDYge2ZvbnQtc2l6ZTogMWVtfQoKCiAgICBoMSwgaDIsIGgzLCBoNCwgaDUsIGg2ewogICAgICAgIGZvbnQtZmFtaWx5OiAiSGVpdGkgU0MiOwogICAgfQoKCiAgICBvbCB7CiAgICAgICAgbWFyZ2luOiAwOwogICAgfQoKICAgIHVsewogICAgICAgIHBhZGRpbmc6IDVweCAzOHB4OwogICAgICAgIG1hcmdpbjogMDsKICAgIH0KCiAgICB1bCBsaSwgbGl7CiAgICAgICAgcGFkZGluZzogMDsKICAgICAgICBtYXJnaW46IDA7CiAgICB9CgogICAgdWwgcCwgb2wgcHsKICAgICAgICBvdmVyZmxvdzogdmlzaWJsZTsKICAgIH0KCgogICAgYmxvY2txdW90ZSB7CiAgICAgICAgLW1vei1ib3gtc2l6aW5nOiBib3JkZXItYm94OwogICAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7CiAgICAgICAgbWFyZ2luOiAxLjZlbSAwOwogICAgICAgIHBhZGRpbmc6IDAgMCAwIDEuMmVtOwogICAgICAgIGJvcmRlci1sZWZ0OiAwLjRlbSBzb2xpZCAjMTZCMEZGOwogICAgICAgIGNvbG9yOiAjODg4ODg4OwogICAgICAgIG1pbi1oZWlnaHQ6MjBweDsKICAgIH0KCgogICAgYmxvY2txdW90ZSBwIHsKICAgICAgICBtYXJnaW46IDAuOGVtIDA7CiAgICB9CgogICAgYmxvY2txdW90ZSBzcGFuLm1kX2xpbmUgewogICAgICAgIG1hcmdpbi1ib3R0b206IDAuMjVlbTsKICAgICAgICBtYXJnaW4tdG9wOiAwLjI1ZW07CiAgICB9CgogICAgYmxvY2txdW90ZSB1bHsKICAgICAgICBwYWRkaW5nOiAwIDE1cHg7CiAgICB9CgogICAgYmxvY2txdW90ZSBzbWFsbCB7CiAgICAgICAgZGlzcGxheTogaW5saW5lLWJsb2NrOwogICAgICAgIG1hcmdpbjogMC44ZW0gMCAwLjhlbSAxLjVlbTsKICAgICAgICBmb250LXNpemU6IDAuOWVtOwogICAgICAgIGNvbG9yOiAjY2NjOwogICAgfQoKCgoKCgogICAgdGFibGUgewogICAgICAgIGxpbmUtaGVpZ2h0OiAxLjc7CiAgICAgICAgLW1vei1ib3gtc2l6aW5nOiBib3JkZXItYm94OwogICAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7CiAgICAgICAgbWFyZ2luOiAxZW0gMDsKICAgICAgICB3aWR0aDogMTAwJTsKICAgICAgICBtYXgtd2lkdGg6IDEwMCU7CiAgICAgICAgYm9yZGVyLXdpZHRoOiAxcHg7CiAgICAgICAgYm9yZGVyLXN0eWxlOiBzb2xpZDsKICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDsKICAgICAgICBib3JkZXItc3BhY2luZzogMDsKICAgICAgICB3b3JkLWJyZWFrOiBub3JtYWw7CiAgICB9CiAgICAKICAgIC8qIGZvciB3ZWNoYXQgb25seSBzdGFydHMgKi8KICAgIHRhYmxlIHRyewogICAgICAgIGJvcmRlci1yaWdodC1zdHlsZTogc29saWQ7CiAgICAgICAgYm9yZGVyLXJpZ2h0LXdpZHRoOiAxcHg7CiAgICB9CiAgICAKICAgIHRhYmxlIHRib2R5ewogICAgICAgIGJvcmRlci1ib3R0b20td2lkdGg6IDFweDsKICAgICAgICBib3JkZXItYm90dG9tLXN0eWxlOiBzb2xpZDsKICAgIH0KICAgIC8qIGZvciB3ZWNoYXQgb25seSBlbmRzICovCgoKICAgIHRhYmxlLCB0YWJsZSB0ciwgdGFibGUgdHIgdGQsIHRhYmxlIHRyIHRoLCB0YWJsZSB0Ym9keSB7CiAgICAgICAgYm9yZGVyLWNvbG9yOiByZ2JhKDIwNSwgMjA1LCAyMDUsIDAuMzUpOwogICAgfQoKIC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gICAgICAgLyogb3ZlcmZsb3c6IGF1dG87ICovCiAgICAgICAgYm9yZGVyOiAxcHggc29saWQgcmdiYSgyMDUsIDIwNSwgMjA1LCAwLjM1KTsKICAgICAgICAvKmJhY2tncm91bmQ6IHJnYmEoMjM1LCAyMzUsIDIzNSwgMC4zNSk7Ki8KICAgICAgICBmb250LXNpemU6IDkwJTsKICAgICAgICBsaW5lLWhlaWdodDoyLjM7CiAgICAgICAgd2hpdGUtc3BhY2U6IHByZS13cmFwOwogICAgfQoKICAgIC5oaWdobGlnaHR0YWJsZSB0ZHsKICAgICAgICAvKmJhY2tncm91bmQtY29sb3I6IHJnYmEoMjM1LCAyMzUsIDIzNSwgMC4zNSkgIWltcG9ydGFudDsqLwogICAgfQoKICAgIC53aXRoX2xpbmVzIHByZXsKICAgICAgICBib3JkZXI6bm9uZTsKICAgICAgICBtYXJnaW4tdG9wOiAwLjJlbTsKICAgICAgICBtYXJnaW4tYm90dG9tOiAwLjJlbTsKICAgICAgICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDsKICAgIH0KCiAgICAuaXNfY29kZV9maWxlIHByZXsKICAgICAgICBib3JkZXI6IG5vbmU7CiAgICAgICAgYmFja2dyb3VuZDogdHJhbnNwYXJlbnQ7CiAgICB9CgogICAgLmNvZGVoaWxpdGUgcHJlewogICAgICAgIC8qd29yZC13cmFwOiBub3JtYWw7Ki8KICAgICAgICBmb250LXNpemU6IDEzcHg7CiAgICB9CgogICAgcHJlIGNvZGV7CiAgICAgICAgYm9yZGVyOm5vbmU7CiAgICAgICAgYmFja2dyb3VuZDogbm9uZTsKICAgICAgICBwYWRkaW5nOiAwOwogICAgICAgIG1hcmdpbjogMDsKICAgIH0KCiAgICBwcmUgcHsKICAgICAgICBtYXJnaW46IDA7CiAgICAgICAgcGFkZGluZzogMDsKICAgIH0KCiAgICAuY29kZWhpbGl0ZSB0aCwgLmNvZGVoaWxpdGUgdGR7CiAgICAgICAgbGluZS1oZWlnaHQ6IDEuOGVtOwogICAgfQoKCiAgICBhewogICAgICAgIGNvbG9yOiAjNDA4M0M0OwogICAgICAgIHRleHQtZGVjb3JhdGlvbjogbm9uZTsKICAgICAgICAvL2JvcmRlci1ib3R0b206IDFweCBzb2xpZCB0cmFuc3BhcmVudDsKICAgIH0KCiAgICBhOmhvdmVyewogICAgICAgIHRleHQtZGVjb3JhdGlvbjogdW5kZXJsaW5lOwogICAgICAgIC8vYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICM0MDgzQzQ7CiAgICB9CgogICAgc3Ryb25nIHsKICAgICAgICBjb2xvcjogIzAwMDAwMDsKICAgICAgICBmb250LXdlaWdodDogYm9sZDsKICAgIH0KCgogICAgLyogZm9yIG1hcmtkb3duICovCgogICAgLmxpbmVub3MgcHJlewoJCWJhY2tncm91bmQ6IHRyYW5zcGFyZW50OwoJCWJvcmRlcjogbm9uZTsKCX0KCgkubGluZW5vc3sKCSAgICBwYWRkaW5nOiAwIDVweCAwIDVweDsKCSAgICB3aWR0aDogMC4wMDElOwoJfQoKCS5oaWdobGlnaHR0YWJsZSBwcmV7CgkgICAgcGFkZGluZzogNXB4IDEwcHg7Cgl9CgogICAgLnRvY3sKICAgICAgICBiYWNrZ3JvdW5kOiBOb25lOwogICAgICAgIGJvcmRlci1yYWRpdXM6IDVweDsKICAgICAgICBib3JkZXI6IDFweCBzb2xpZCBOb25lOwogICAgICAgIG1hcmdpbjogMjdweCAwIDQ3cHggMDsKICAgICAgICBwYWRkaW5nOiAxMHB4IDA7CiAgICB9CgogICAgLnRvYyB1bHsKICAgICAgICAvL3BhZGRpbmc6IDVweCA0MnB4OwogICAgfQoKICAgIC50b2MgdWwgbGl7CiAgICAgICAgcGFkZGluZzogMDsKICAgICAgICBtYXJnaW46IDA7CiAgICB9CiAgICAudG9jIGF7CiAgICAgICAgY29sb3I6ICMzQzNDM0M7CiAgICB9CgoKCiAgICAudG9kb19pdGVtewogICAgICAgIGxpc3Qtc3R5bGU6IG5vbmU7CiAgICAgICAgbWFyZ2luLWxlZnQ6IC0xLjVlbQogICAgfQogICAgLnRvZG9faXRlbSAudG9kb19pdGVtIHsKICAgICAgICBtYXJnaW4tbGVmdDogYXV0bzsKICAgIH0KCiAgICAudG9kb19kb25lX2l0ZW17CiAgICAgICAgY29sb3I6ICM5OTk5OTk7CiAgICB9CgogICAgLnRvZG9fdW5kb25lX2l0ZW17CiAgICAgICAgY29sb3I6ICNDODVBNTc7CiAgICB9CgoKICAgIHVsIGxpLnRvZG9faXRlbXsKCWxpc3Qtc3R5bGUtdHlwZTogbm9uZTsKICAgIH0KCiAgICB1bCBsaS50b2RvX2l0ZW06YmVmb3JlewogICAgICAgIGNvbnRlbnQ6ICfimJAnOwogICAgICAgIC8qcGFkZGluZy1yaWdodDogMC4yZW07Ki8KICAgICAgICBmb250LWZhbWlseTogYXJpYWw7CiAgICB9CgogICAgdWwgbGkudG9kb19kb25lX2l0ZW06YmVmb3JlewogICAgICAgIGNvbnRlbnQ6ICfimJEnOwogICAgICAgIC8qcGFkZGluZy1yaWdodDogMC4yZW07Ki8KICAgICAgICBmb250LWZhbWlseTogYXJpYWw7CiAgICB9CgogICAgdWwgbGkudG9kb19pdGVtIGlucHV0ewogICAgICAgIGRpc3BsYXk6bm9uZQogICAgfQoKCiAgICAvKnB5Z21lbnRzKi8KCiAgICAuY29kZWhpbGl0ZXsKICAgICAgICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudCAhaW1wb3J0YW50OwogICAgfQoKICAgIHRhYmxlLmNvZGVoaWxpdGV0YWJsZXsgYm9yZGVyOm5vbmU7IH0KCgogICAgLmNvZGVoaWxpdGV0YWJsZSB0ZHsgYm9yZGVyOiBub25lOyBwYWRkaW5nOiAwO30KCiAgICAuZmxvdy1ncmFwaGljLCAubWRfYmxvY2tfc2VjdGlvbl9mb3JfZmxvd19ncmFwaGlje3RleHQtYWxpZ246IGNlbnRlcn0KICAgIC5mbG93LWdyYXBoaWMgeyBvdmVyZmxvdy14OiBhdXRvO30KICAgI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nZpIHsgY29sb3I6ICMwMDY4OEIgfSAvKiBOYW1lLlZhcmlhYmxlLkluc3RhbmNlICovCi5jb2RlaGlsaXRlIC52bSB7IGNvbG9yOiAjMDA2ODhCIH0gLyogTmFtZS5WYXJpYWJsZS5NYWdpYyAqLwouY29kZWhpbGl0ZSAuaWwgeyBjb2xvcjogI0I0NTJDRCB9IC8qIExpdGVyYWwuTnVtYmVyLkludGVnZXIuTG9uZyAqLwogICAgLyogcGFnZV9jc3MgKi8KCiAgICAKICAgIGh0bWx7CiAgICAgICAgYmFja2dyb3VuZDogI0VFRUVFRTsKICAgIH0KICAgIGJvZHl7CiAgICAgICAgd2lkdGg6IDkwJTsKICAgICAgICBtYXgtd2lkdGg6IDk2MHB4OwogICAgICAgIGJhY2tncm91bmQ6ICNGRkZGRkY7CiAgICAgICAgbWFyZ2luOiAzZW0gYXV0byAwOwogICAgICAgIHBhZGRpbmctdG9wOiAyZW07CiAgICAgICAgYm9yZGVyOiAxcHggc29saWQgI0VFRUVFRTsKICAgICAgICBib3JkZXItd2lkdGg6IDAgMXB4OwogICAgfQoKICAgIC5wb3N0ewogICAgICAgIHBhZGRpbmc6IDUlIDEwJTsKICAgICAgICBtYXJnaW4tdG9wOiAwOwogICAgICAgIG1hcmdpbi1ib3R0b206IDA7CiAgICB9CiAgICAKCiAgICAudGl0bGVfY29udGFpbmVyewogICAgICAgIG1hcmdpbjogLTJlbSAwIDMuNWVtOwogICAgICAgIHBhZGRpbmctYm90dG9tOiAyZW07CiAgICAgICAgYm9yZGVyLWJvdHRvbTogM3B4IGRvdWJsZSAjRUVFRUVFOwogICAgfQogICAgLnRpdGxlX2NvbnRhaW5lciBoMXsKICAgICAgICBtYXJnaW4tdG9wOiAxLjJlbTsKICAgICAgICBtYXJnaW4tYm90dG9tOiAwLjZlbTsKICAgICAgICBsaW5lLWhlaWdodDogMS4zNTsKICAgICAgICBmb250LXNpemU6IDIuMjVlbTsKICAgIH0KICAgIC50aXRsZV9jb250YWluZXIgaDJ7CiAgICAgICAgY29sb3I6ICM4ODg4ODg7CiAgICAgICAgZm9udC1zaXplOiAxZW07CiAgICAgICAgZm9udC13ZWlnaHQ6IG5vcm1hbDsKICAgICAgICBwYWRkaW5nLWJvdHRvbTogMmVtOwogICAgICAgIGxpbmUtaGVpZ2h0OiAxLjM1OwogICAgICAgIG1hcmdpbi1ib3R0b206IC0yZW07CiAgICB9CgogICAgQG1lZGlhIG9ubHkgc2NyZWVuIGFuZCAobWF4LXdpZHRoOiA3NjBweCl7CiAgICAgICAgaHRtbHsKICAgICAgICAgICAgYmFja2dyb3VuZDogdHJhbnNwYXJlbnQ7CiAgICAgICAgfQogICAgICAgIGJvZHl7CiAgICAgICAgICAgIG1hcmdpbjogMDsKICAgICAgICB9CiAgICAgICAgLnBvc3R7CiAgICAgICAgICAgIHBhZGRpbmc6IDA7CiAgICAgICAgfQogICAgfQogICAgLyogcGFnZV9jc3MgKi8KCiAgICA=">
<!--header_scripts-->
</head>
<body>
<div class="post">
<div class="post_body">
<div class=title_container>
<h1> 用python实现微信消息防撤回 </h1>
</div>
<blockquote class="blockquote_lines_2">
<p class="md_block">
<span class="md_line md_line_start">这个脚本是基于 <a class="md_compiled" href="https://github.com/littlecodersh/ItChat">itchat</a> 库来实现的。<br /></span>
<span class="md_line md_line_end">itchat是一个开源的微信个人号接口,使用python调用微信从未如此简单。</span>
</p>
</blockquote>
<p class="md_block">
<span class="md_line md_line_start">使用不到三十行的代码,你就可以完成一个能够处理所有信息的微信机器人。<br /></span>
<span class="md_line">当然,该api的使用远不止一个机器人,更多的功能等着你来发现,比如这些。<br /></span>
<span class="md_line">该接口与公众号接口itchatmp共享类似的操作方式,学习一次掌握两个工具。<br /></span>
<span class="md_line md_line_end">如今微信已经成为了个人社交的很大一部分,希望这个项目能够帮助你扩展你的个人的微信号、方便自己的生活。</span>
</p>
<h2 id="toc_0" class="h16 md_first_h">准备环境:</h2>
<ul>
<li class="md_li"><span>安装itchat库: <code>pip install itchat</code>
</span></li>
</ul>
<h2 id="toc_1" class="h16">代码实现:</h2>
<div class="codehilite code_lang_python highlight"><pre><span></span><span class="ch">#!/usr/bin/env python3</span>
<span class="c1"># -*- coding: utf-8 -*-</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">import</span> <span class="nn">shutil</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">import</span> <span class="nn">itchat</span>
<span class="kn">from</span> <span class="nn">itchat.content</span> <span class="kn">import</span> <span class="o">*</span>
<span class="c1"># 定义一个字典,保存消息的信息。</span>
<span class="n">msg_dict</span> <span class="o">=</span> <span class="p">{}</span>
<span class="c1"># 创建一个目录,用于存放消息临时文件。</span>
<span class="n">rec_tmp_dir</span> <span class="o">=</span> <span class="s2">"/Users/matianhe/itchat/rec_tmp/"</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">rec_tmp_dir</span><span class="p">):</span>
<span class="n">os</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">rec_tmp_dir</span><span class="p">)</span>
<span class="n">face_bug</span> <span class="o">=</span> <span class="bp">None</span>
<span class="c1"># 注册消息接收器</span>
<span class="nd">@itchat.msg_register</span><span class="p">([</span><span class="n">TEXT</span><span class="p">,</span> <span class="n">PICTURE</span><span class="p">,</span> <span class="n">MAP</span><span class="p">,</span> <span class="n">CARD</span><span class="p">,</span> <span class="n">SHARING</span><span class="p">,</span> <span class="n">RECORDING</span><span class="p">,</span>
<span class="n">ATTACHMENT</span><span class="p">,</span> <span class="n">VIDEO</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">handler_receive_msg</span><span class="p">(</span><span class="n">msg</span><span class="p">):</span>
<span class="k">global</span> <span class="n">face_bug</span>
<span class="n">msg_time_rec</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M%S"</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">())</span>
<span class="n">msg_id</span> <span class="o">=</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'MsgId'</span><span class="p">]</span>
<span class="n">msg_time</span> <span class="o">=</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'CreateTime'</span><span class="p">]</span>
<span class="n">msg_from</span> <span class="o">=</span> <span class="p">(</span><span class="n">itchat</span><span class="o">.</span><span class="n">search_friends</span><span class="p">(</span><span class="n">userName</span><span class="o">=</span><span class="n">msg</span><span class="p">[</span><span class="s1">'FromUserName'</span><span class="p">]</span>
<span class="p">))[</span><span class="s2">"NickName"</span><span class="p">]</span>
<span class="n">msg_content</span> <span class="o">=</span> <span class="bp">None</span>
<span class="n">msg_share_url</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">if</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Text'</span> <span class="ow">or</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Friends'</span><span class="p">:</span>
<span class="n">msg_content</span> <span class="o">=</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Text'</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Recording'</span> <span class="ow">or</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Attachment'</span> \
<span class="ow">or</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Video'</span> <span class="ow">or</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Picture'</span><span class="p">:</span>
<span class="n">msg_content</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">""</span> <span class="o">+</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'FileName'</span><span class="p">]</span>
<span class="n">msg</span><span class="p">[</span><span class="s1">'Text'</span><span class="p">](</span><span class="n">rec_tmp_dir</span> <span class="o">+</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'FileName'</span><span class="p">])</span>
<span class="k">elif</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Card'</span><span class="p">:</span>
<span class="n">msg_content</span> <span class="o">=</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'RecommendInfo'</span><span class="p">][</span><span class="s1">'NickName'</span><span class="p">]</span> <span class="o">+</span> <span class="sa">r</span><span class="s2">" 的名片"</span>
<span class="k">elif</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Map'</span><span class="p">:</span>
<span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">location</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="s2">"<location x=</span><span class="se">\"</span><span class="s2">(.*?)</span><span class="se">\"</span><span class="s2"> y=</span><span class="se">\"</span><span class="s2">(.*?</span><span class="se">\"</span><span class="s2">.*lable= </span><span class="se">\</span>
<span class="s2"> </span><span class="se">\"</span><span class="s2">(.*?)</span><span class="se">\"</span><span class="s2">.*"</span><span class="p">,</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'OriContent'</span><span class="p">])</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
<span class="mi">3</span><span class="p">)</span>
<span class="k">if</span> <span class="n">location</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">msg_content</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">"纬度->"</span> <span class="o">+</span> <span class="n">x</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span> <span class="o">+</span> <span class="s2">" 经度->"</span> <span class="o">+</span> <span class="n">y</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">msg_content</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">""</span> <span class="o">+</span> <span class="n">location</span>
<span class="k">elif</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Sharing'</span><span class="p">:</span>
<span class="n">msg_content</span> <span class="o">=</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Text'</span><span class="p">]</span>
<span class="n">msg_share_url</span> <span class="o">=</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Url'</span><span class="p">]</span>
<span class="n">face_bug</span> <span class="o">=</span> <span class="n">msg_content</span>
<span class="n">msg_dict</span><span class="o">.</span><span class="n">update</span><span class="p">({</span>
<span class="n">msg_id</span><span class="p">:</span> <span class="p">{</span>
<span class="s2">"msg_from"</span><span class="p">:</span> <span class="n">msg_from</span><span class="p">,</span> <span class="s2">"msg_time"</span><span class="p">:</span> <span class="n">msg_time</span><span class="p">,</span>
<span class="s2">"msg_time_rec"</span><span class="p">:</span> <span class="n">msg_time_rec</span><span class="p">,</span> <span class="s2">"msg_type"</span><span class="p">:</span> <span class="n">msg</span><span class="p">[</span><span class="s2">"Type"</span><span class="p">],</span>
<span class="s2">"msg_content"</span><span class="p">:</span> <span class="n">msg_content</span><span class="p">,</span> <span class="s2">"msg_share_url"</span><span class="p">:</span> <span class="n">msg_share_url</span>
<span class="p">}</span>
<span class="p">})</span>
<span class="nd">@itchat.msg_register</span><span class="p">([</span><span class="n">NOTE</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">send_msg_helper</span><span class="p">(</span><span class="n">msg</span><span class="p">):</span>
<span class="k">global</span> <span class="n">face_bug</span>
<span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="sa">r</span><span class="s2">"\<\!\[CDATA\[.*撤回了一条消息\]\]\>"</span><span class="p">,</span> <span class="n">msg</span><span class="p">[</span><span class="s1">'Content'</span><span class="p">])</span> \
<span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="n">old_msg_id</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="s2">"\<msgid\>(.*?)\<\/msgid\>"</span><span class="p">,</span> \
<span class="n">msg</span><span class="p">[</span><span class="s1">'Content'</span><span class="p">])</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">old_msg</span> <span class="o">=</span><span class="n">msg_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">old_msg_id</span><span class="p">,</span> <span class="p">{})</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">old_msg_id</span><span class="p">)</span> <span class="o"><</span> <span class="mi">11</span><span class="p">:</span>
<span class="n">itchat</span><span class="o">.</span><span class="n">send_file</span><span class="p">(</span><span class="n">rec_tmp_dir</span> <span class="o">+</span> <span class="n">face_bug</span><span class="p">,</span>
<span class="n">toUserName</span><span class="o">=</span><span class="s1">'filehelper'</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">rev_tmp_dir</span> <span class="o">+</span> <span class="n">face_bug</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">msg_body</span> <span class="o">=</span> <span class="s2">"有人撤回消息"</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> \
<span class="o">+</span> <span class="n">old_msg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'msg_from'</span><span class="p">)</span> <span class="o">+</span> <span class="s2">" 撤回了 "</span> \
<span class="o">+</span> <span class="n">old_msg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'msg_type'</span><span class="p">)</span> <span class="o">+</span> <span class="s2">" 消息"</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> \
<span class="o">+</span> <span class="n">old_msg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'msg_time_rec'</span><span class="p">)</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> \
<span class="o">+</span> <span class="sa">r</span><span class="s2">""</span> <span class="o">+</span> <span class="n">old_msg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'msg_content'</span><span class="p">)</span>
<span class="k">if</span> <span class="n">old_msg</span><span class="p">[</span><span class="s1">'msg_type'</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Sharing"</span><span class="p">:</span>
<span class="n">msg_body</span> <span class="o">+=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">就是这个连接->"</span> <span class="o">+</span> <span class="n">old_msg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'msg_share_url'</span><span class="p">)</span>
<span class="n">itchat</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">msg_body</span><span class="p">,</span> <span class="n">toUserName</span><span class="o">=</span><span class="s1">'filehelper'</span><span class="p">)</span>
<span class="k">if</span> <span class="n">old_msg</span><span class="p">[</span><span class="s2">"msg_type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Picture"</span> \
<span class="ow">or</span> <span class="n">old_msg</span><span class="p">[</span><span class="s2">"msg_type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Recording"</span> \
<span class="ow">or</span> <span class="n">old_msg</span><span class="p">[</span><span class="s2">"msg_type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Video"</span> \
<span class="ow">or</span> <span class="n">old_msg</span><span class="p">[</span><span class="s2">"msg_type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"Attachment"</span><span class="p">:</span>
<span class="nb">file</span> <span class="o">=</span> <span class="s1">'@fil@</span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span> <span class="p">(</span><span class="n">rec_tmp_dir</span> <span class="o">+</span> <span class="n">old_msg</span><span class="p">[</span><span class="s1">'msg_content'</span><span class="p">])</span>
<span class="n">itchat</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">msg</span><span class="o">=</span><span class="nb">file</span><span class="p">,</span> <span class="n">toUserName</span><span class="o">=</span><span class="s1">'filehelper'</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">rec_tmp_dir</span> <span class="o">+</span> <span class="n">old_msg</span><span class="p">[</span><span class="s1">'msg_content'</span><span class="p">])</span>
<span class="n">msg_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">old_msg_id</span><span class="p">)</span>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span>
<span class="n">itchat</span><span class="o">.</span><span class="n">auto_login</span><span class="p">(</span><span class="n">hotReload</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">enableCmdQR</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
<span class="n">itchat</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
</pre></div>
<!--block_code_end-->
<p class="md_block">
<span class="md_line md_line_dom_embed md_line_start"><strong>运行程序,扫码登录</strong><br /></span>
<span class="md_line md_line_dom_embed md_line_with_image md_line_end"><img class="md_compiled " src="https://upload-images.jianshu.io/upload_images/7080951-579086225187413c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/700" alt="" title="" ></span>
</p>
<h2 id="toc_2" class="h16">实现思路:</h2>
<p class="md_block md_has_block_below md_has_block_below_blockquote">
<span class="md_line md_line_start md_line_end">注册两个消息接收器,一个接收平时消息,并把消息信息存到字典里。另一个监听是否有撤回操作,如果有撤回操作则取出第一个监听器内的消息,用文件传输助手发送到手机上。</span>
</p>
<blockquote class="blockquote_lines_2">
<p class="md_block">
<span class="md_line md_line_start">GitHub地址:https://github.com/matianhe/wx_revoke<br /></span>
<span class="md_line md_line_dom_embed md_line_end"><!--blockquote--></span>
</p>
</blockquote>
</div>
</div>
<!--mathjax-->
<!--mermaid-->
</body>
</html>