Jump to content
Amidamaru

[Python2] Ajutor script

Recommended Posts

Posted

Hello,

Un nene a descoperit cum sa traga followers de pe conturi de twitter, Collecting Twitter Followers with 25 lines of Python, si a scris un script in Python2 dupa cum urmeaza:

"

import tweepy

import time

#insert your Twitter keys here

consumer_key ='bla bla'

consumer_secret='bla bla'

access_token='bla bla'

access_secret='bla bla'

auth = tweepy.auth.OAuthHandler(consumer_key, consumer_secret)

auth.set_access_token(access_token, access_secret)

api = tweepy.API(auth)

list= open('/go-to-war/Desktop/twitter_list.txt','w')

if(api.verify_credentials):

print 'We sucessfully logged in'

user = tweepy.Cursor(api.followers, screen_name="<targeted_twitter_account>").items()

while True:

try:

u = next(user)

list.write(u.screen_name +' n')

except:

time.sleep(15*60)

print 'We got a timeout ... Sleeping for 15 minutes'

u = next(user)

list.write(u.screen_name +' n')

list.close()

"

Intrebarea mea este, l-a incercat cineva si i-a mers? Eu l-am pornit, sta o perioda pana expira cele 15 minute alocate unui interval valid de interogare si pe urma iese cu urmatoarea eroare:

"Traceback (most recent call last):

File "twitter_followers_harvesting.py", line 28, in <module>

u = next(user)

File "/usr/lib/python2.7/dist-packages/tweepy/cursor.py", line 110, in next

self.current_page = self.page_iterator.next()

File "/usr/lib/python2.7/dist-packages/tweepy/cursor.py", line 60, in next

cursor=self.next_cursor, *self.args, **self.kargs

File "/usr/lib/python2.7/dist-packages/tweepy/binder.py", line 179, in _call

return method.execute()

File "/usr/lib/python2.7/dist-packages/tweepy/binder.py", line 162, in execute

raise TweepError(error_msg, resp)

tweepy.error.TweepError: [{'message': 'Sorry, that page does not exist', 'code': 34}]

"

Merci fain.

Posted

Uite quickfix-ul:

try:
user = tweepy.Cursor(api.followers, screen_name="alecsafk").items()
except tweepy.error.TweepError:
pass

In loc de alecsafk pui twitter username-ului de la care vrei followeri.

Posted (edited)

Hello,

Multumesc. Il incerc acum. Aseara eram mult prea rupt...

asadar aceasta:

user = tweepy.Cursor(api.followers, screen_name="<targeted_twitter_account>").items()

va devenii:

try:

user = tweepy.Cursor(api.followers, screen_name="<targeted_twitter_account>").items()

except tweepy.error.TweepError:

pass

Edited by Amidamaru

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...