def f_grab_cmd_from_twitter_profile(profile_name):
"""grab 0xXXXXXXXX tag from profile, tag must match [a-zA-Z0-9_]
:rtype: string
:param profile_name: twitter profile name without leading @
:return: string embedded in the profile description
"""
url = 'https://twitter.com/%(profile)s'
payload = {
'profile': profile_name
}
html = requests.get(url % payload)
soup = soupy(html.text)
profile_description = soup.find('meta', {'name': 'description'})['content']
match = re.search('0x(\w+)', profile_description)
output = match.group(1) # group 1 consists of match between ( )
return str(output)
评论列表
文章目录