Merge pull request #28 from zuoa/master

匹配xml中CDATA字段
This commit is contained in:
Urinx
2016-02-26 12:05:14 +08:00
+1
View File
@@ -801,6 +801,7 @@ class WebWeixin(object):
if pm: return pm.group(1) if pm: return pm.group(1)
elif fmat == 'xml': elif fmat == 'xml':
pm = re.search('<{0}>([^<]+)</{0}>'.format(key),content) pm = re.search('<{0}>([^<]+)</{0}>'.format(key),content)
if not pm: pm = re.search('<{0}><\!\[CDATA\[(.*?)\]\]></{0}>'.format(key),content)
if pm: return pm.group(1) if pm: return pm.group(1)
return '未知' return '未知'