mirror of
https://github.com/liuwons/wxBot.git
synced 2026-10-16 20:50:39 +08:00
add msg type 49 content
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
import webbrowser
|
||||
import pyqrcode
|
||||
import requests
|
||||
@@ -39,13 +40,17 @@ def show_image(file_path):
|
||||
webbrowser.open(file_path)
|
||||
|
||||
class SafeSession(requests.Session):
|
||||
def request(self, *args, **kwargs):
|
||||
def request(self, method, url, params=None, data=None, headers=None, cookies=None, files=None, auth=None,
|
||||
timeout=None, allow_redirects=True, proxies=None, hooks=None, stream=None, verify=None, cert=None,
|
||||
json=None):
|
||||
for i in range(3):
|
||||
try:
|
||||
return super(SafeSession, self).request(*args, **kwargs)
|
||||
except:
|
||||
pass
|
||||
return super(SafeSession, self).request(*args, **kwargs)
|
||||
return super(SafeSession, self).request(method, url, params, data, headers, cookies, files, auth,
|
||||
timeout,
|
||||
allow_redirects, proxies, hooks, stream, verify, cert, json)
|
||||
except Exception as e:
|
||||
print e.message,traceback.format_exc()
|
||||
continue
|
||||
|
||||
|
||||
class WXBot:
|
||||
@@ -244,6 +249,7 @@ class WXBot:
|
||||
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_contact_prefer_name(name):
|
||||
if name is None:
|
||||
@@ -475,7 +481,9 @@ class WXBot:
|
||||
'title': msg['FileName'],
|
||||
'desc': self.search_content('des', content, 'xml'),
|
||||
'url': msg['Url'],
|
||||
'from': self.search_content('appname', content, 'xml')}
|
||||
'from': self.search_content('appname', content, 'xml'),
|
||||
'content':msg.get('content')#有的公众号会发一次性3 4条链接一个大图,如果只url那只能获取第一条,content里面有所有的链接
|
||||
}
|
||||
if self.DEBUG:
|
||||
print ' %s[Share] %s' % (msg_prefix, app_msg_type)
|
||||
print ' --------------------------'
|
||||
@@ -483,6 +491,7 @@ class WXBot:
|
||||
print ' | desc: %s' % self.search_content('des', content, 'xml')
|
||||
print ' | link: %s' % msg['Url']
|
||||
print ' | from: %s' % self.search_content('appname', content, 'xml')
|
||||
print ' | content: %s' % msg.get('content')[:20]
|
||||
print ' --------------------------'
|
||||
|
||||
elif mtype == 62:
|
||||
|
||||
Reference in New Issue
Block a user