我的代码有问题
pageNameOrId = 'Ch3Thailand'
source_url = 'https://www.facebook.com/pg/%s/posts/' % pageNameOrId
content = html.unescape(requests.get(source_url).text)
postInfos = getPostInfosFromContent(content)
posts = getPostsFromContent(content, postInfos)
urlResult = re.search(r'\/pages_reaction_units.*?unit_count=8', content).group()
print(len(posts), posts[-1])
然后得到这样的错误
AttributeError Traceback (most recent call last)
<ipython-input-29-69969f51fdc6> in <module>()
----> 6 urlResult = re.search(r'\/pages_reaction_units.*?unit_count=8', content).group()
AttributeError: 'NoneType' object has no attribute 'group'
此代码
简单地等于
None
。可能正则表达式与任何内容都不匹配,因此它返回None
相关问题 更多 >
编程相关推荐