MCPcopy Create free account
hub / github.com/cxapython/catvm / get_user_id

Function get_user_id

twitter/twitter_article.py:47–60  ·  view source on GitHub ↗
(name, gt)

Source from the content-addressed store, hash-verified

45
46
47def get_user_id(name, gt):
48 headers = {
49 'authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA',
50 'x-guest-token': f'{gt}',
51 }
52
53 params = (
54 ('variables', f'{{"screen_name":"{name}","withHighlightedLabel":true,"withSuperFollowsUserFields":false}}'),
55 )
56
57 response = requests.get('https://twitter.com/i/api/graphql/G07SmTUd0Mx7qy3Az_b52w/UserByScreenNameWithoutResults',
58 headers=headers, params=params)
59 user_id = json.loads(response.text).get('data').get('user').get('rest_id')
60 return user_id
61
62
63def crawl(name):

Callers 1

crawlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected