- rel = t.search.tweets(q='#' + g['stuff'])['statuses']
- h, w = os.popen('stty size', 'r').read().split()
-
- printNicely(grey('*' * int(w) + '\n'))
- print('Newest', SEARCH_MAX_RECORD, 'tweet: \n')
- for i in xrange(5):
- draw(t=rel[i], keyword=g['stuff'].strip())
- printNicely(grey('*' * int(w) + '\n'))
+ try:
+ if g['stuff'][0] == '#':
+ rel = t.search.tweets(q=g['stuff'])['statuses']
+ print('Newest', SEARCH_MAX_RECORD, 'tweet:')
+ for i in xrange(SEARCH_MAX_RECORD):
+ draw(t=rel[i], keyword=g['stuff'].strip()[1:])
+ printNicely('')
+ else:
+ print(red('A keyword should be a hashtag (like \'#AKB48\')'))
+ except:
+ print(red('Sorry I can\'t understand.'))