-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHackTweetBot.py
More file actions
45 lines (26 loc) · 809 Bytes
/
Copy pathHackTweetBot.py
File metadata and controls
45 lines (26 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
Get the news from the hackernews regarding the tech and paste it on the twitter
'''
import tweepy
import ExtractHackerNews
import time
consumer_key ='XXXXXXXX'
consumer_secret='XXXXXXXXX'
access_token='156930434-XXXXXXX'
access_token_secret='XXXXXXX'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
news=[]
status=''
url_link=''
while True:
for res in ExtractHackerNews.getNews():
if res.url is not None:
if "github" in res.url.lower():
status = res.title
url_link = res.url
break
api.update_status(status=status+'\n'+'- feed from HackerNews'+'\n'+url_link)
print 'tweet successfully posted'
time.sleep(12*60*60)