From 3ba3ab0b249823fefad9598547058de948287e58 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 13 Jan 2014 21:54:15 +0800 Subject: [PATCH] pass thread id as parameter. --- iloveck101/iloveck101.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iloveck101/iloveck101.py b/iloveck101/iloveck101.py index 7995e13..d905d91 100755 --- a/iloveck101/iloveck101.py +++ b/iloveck101/iloveck101.py @@ -18,6 +18,7 @@ REQUEST_HEADERS = {'User-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36'} BASE_URL = 'http://ck101.com/' +THREAD_URL = BASE_URL + 'thread-%s-1-1.html' CHUNK_SIZE = 3 @@ -37,7 +38,11 @@ def iloveck101(url): except KeyboardInterrupt: print 'I love ck101' else: - sys.exit('This is not ck101 url') + url = url.strip() + if url.isdigit(): + retrieve_thread(THREAD_URL % url) + else: + sys.exit('This is not ck101 url') def retrieve_thread_list(url):