Tweepy ist nützlich, um die Twitter-API in Python zu erreichen Tweepy Official Github
Es unterstützt fast alle (vielleicht alle?) APIs, sodass Sie alles treffen können.
Weitere Informationen zu Consumer-Schlüsseln und Access-Token finden Sie unter hier.
Holen Sie sich die ID des Followers eines Benutzers
api_test.py
import sys
import tweepy
consumer_key = sys.argv[1]
consumer_secret = sys.argv[2]
access_token = sys.argv[3]
access_token_secret = sys.argv[4]
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
print api.followers_ids('yamaguchiyuto')
$ python api_test.py [consumer key] [consumer secret] [access token] [access token secret]
[90429667, 202652239, 42027820, 19596021, 2195153192, 117687842, 2258629297, 1406786214, 16555745, 14842736, 66415991, 434223, 2346982724, 2333008268, 831055380, 93408266, 17268882, 162083740, 504019119, 228762898, 11722222, 229762645, 132796590, 5623272, 25038224, 1597143732, 110659688, 10121792, 404563048, 181644477, 314346343, 608353, 235254268, 433214780, 6164512, 591682167, 91910392, 44864602, 19161647, 189232458, 396851678, 383715259, 1290571964, 7229862, 337344406, 636211860, 143365117, 16271729, 138080138, 90562000, 377193688, 107033612, 1193350651, 552235322, 533047270, 626637703, 13602752, 1113534024, 513755822, 190063726, 869907272, 386865386, 68339158, 159665742, 901697208, 108157800, 159734839, 815082048, 44519653, 410733253, 847537580, 340900181, 18631141, 89664770, 94797531, 54506895, 147195422, 61168347, 11865812, 457499777, 146706476, 752402191, 753169801, 14488235, 91264606, 17571464, 5597892, 5605872, 426486052, 31390654, 74172008, 49980803, 63187556, 5530022, 97451914, 5528512, 144551657, 58169007, 456506958, 49631101, 178020965, 221644210, 560139598, 8123222, 96398492, 207086775, 186427246, 46570373, 460160272, 127436086, 540747882, 201246351, 291519868, 108860769, 166424351, 132092733, 393374629, 284485000, 136290282, 8424582, 166255351, 87977515, 52575494, 268667702, 135520819, 209969174, 498912433, 496731820, 17916105, 144728570, 344460636, 45550596, 17916220, 96698109, 45092094, 248132475, 214807446, 45122807, 8216412, 187127726, 174820685, 147995371, 108201390, 365348844, 226482519, 116358272, 60355627, 281121335, 56304040, 68645532, 252214105, 248993119, 370616354, 202617625, 5904392, 314036763, 454902363, 119320073, 169429386, 135457590, 265418637, 54505412, 9492602, 94223074, 211548465, 266770141, 137303807, 57221533, 5756062, 12263082, 395771001, 9074002, 140365856, 97645491, 114654723, 156286290, 8428752, 316154491, 222325990, 374043063, 134122371, 76690610, 121094836, 43491198, 135831308, 384080093, 90130178, 270844208, 20692391, 120722054, 64721692, 106022456, 17724558, 279072297, 213220347, 320642436, 57039741, 166399861, 187942923, 265305533, 185990526, 38007036]
Recommended Posts