def find_id(self, contents=None):
contents = self._load_url() if not contents else contents
if not contents:
return False
pattern = r'(entity_id["\' ]{1,3}:["\' ]{1,3})([\d]+)'
regex = re.compile(pattern, flags=re.VERBOSE)
match = regex.search(contents)
try:
return match.group(2)
except (IndexError, AttributeError):
return False
评论列表
文章目录