It seems Python on non-linux platform, e.g., Mac and Windows, doesn't support Unicode so well. I added another option to specify target encoding if necessary and the default encoding is 'utf-8'. This patch is against Tweet to Text 2.
--encoding=utf-8 - to specify encoding match your terminal.diff --git a/track.py b/track.py index e651f51..1842e61 100644 --- a/track.py +++ b/track.py @@ -52,6 +52,9 @@ class App: parser.add_option('-p', '--pages', default=4, type='int', dest='pages', help='max pages') + parser.add_option('--encoding', + default='utf-8', dest='encoding', + help='output encoding') self.options, self.args = parser.parse_args() @@ -81,7 +84,8 @@ class App: history.reverse() for i in history: - print format_tweet(i) + tweet = format_tweet(i) + print tweet.encode(self.options.encoding, 'replace') if verbose:
Because of my debate, I found a duplication bug in Tweet to Text that led me to post the fix here.
diff --git a/track.py b/track.py index ea27c2f..e651f51 100644 --- a/track.py +++ b/track.py @@ -65,7 +65,9 @@ class App: query = ' '.join(self.args) results = search(query) for i in results['results']: - history.append(i) + if i['id'] not in keys: + history.append(i) + keys[i['id']] = 1 for p in range(self.options.pages-1): if 'next_page' not in results: @@ -73,7 +75,9 @@ class App: next_page = results['next_page'] results = search(query, next_page[1:]) for i in results['results']: - history.append(i) + if i['id'] not in keys: + history.append(i) + keys[i['id']] = 1
หลังจาก Tweet to Text และ Twitter Debate ดูเหมือนว่าดีเบตจะได้รับความนิยมมากขึ้น วันนี้ตอนสายๆ มีอีกหนึ่งวง วงนี้ใหญ่หน่อย มันเริ่มจากแค่ Chrome มาจบที่ mindset สนุกดี
Submitted by sugree on Wed, 09/03/2008 - 13:20.Sometimes you might want to keep your old tweet in your blog forever. Publish the fruitful conversation or debate in your blog everlasting long. There is no easy way yet as far as I know. But it is possible to use Twitter Search. @markpeak asked me for help. Below script is my help.
Submitted by sugree on Tue, 09/02/2008 - 10:42.