· 7 years ago · Jan 04, 2018, 06:28 AM
1#!/usr/bin/env pythons
2from twython import Twython
3from time import sleep
4import sqlite3
5
6db = sqlite3.connect('./mydb')
7cursor = db.cursor()
8
9cursor.execute ('''SELECT app_key, app_secret, oauth_token, oauth_token_secret FROM users''')
10
11for row in cursor:
12 twitter = Twython(row[0], row[1], row[2], row[3])
13 search = twitter.search(q = '#peace', count = 10)
14 tweets = search['statuses']
15 for tweet in tweets:
16 b = tweet['id']
17 print(b)
18 twitter.retweet(id = b)
19 sleep(60)
20
21db.close()
22
23#!/usr/bin/env pythons
24from twython import Twython
25from time import sleep
26import sqlite3
27
28db = sqlite3.connect('./mydb')
29cursor = db.cursor()
30
31cursor.execute ('''SELECT app_key, app_secret, oauth_token, oauth_token_secret FROM users''')
32
33for row in cursor:
34 twitter = Twython('{0}, {1}, {2}, {3}'.format(row[0], row[1], row[2], row[3]))
35 search = twitter.search(q = '#peace', count = 10)
36 tweets = search['statuses']
37 for tweet in tweets:
38 b = tweet['id']
39 print(b)
40 twitter.retweet(id = b)
41 sleep(60)
42
43db.close()