-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoFlowLeakerServer2.py
56 lines (43 loc) · 1.24 KB
/
AutoFlowLeakerServer2.py
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
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-01-11 22:25:15
# @Author : Tom Hu ([email protected])
# @Link : http://h1994st.com
# @Version : 1.0
import json
import time
from Twitter import Twitter
from Evernote import Evernote
from Wordpress import Wordpress
# Evernote (ctom357) -> Github (covertsan)
# Wordpress (covertsan.wordpress.com) <- Ghost ()
sender = Evernote()
receiver = Wordpress()
print 'Run'
print 'Clear all'
sender.delete_all()
receiver.delete_all()
t = Twitter()
print '-----------'
while True:
results = receiver.receive_all()
if len(results) > 0:
query = results[0].content
print 'Receive:', query
results = t._api.GetSearch(
raw_query='q={0}%20&result_type=recent&count=10'.format(query))
print dir(results[0])
res = [{
'content': status.text,
'authors': status.user.screen_name,
'time': status.created_at
} for status in results]
print res
print 'Send response'
sender.send(
json.dumps(res), title='Twitter Digest %d' % int(time.time()))
print 'Clear receiver'
receiver.delete_all()
else:
# print 'Nothing, sleep 1 seconds'
time.sleep(1)