diff --git a/Sina2WordPressCore.py b/Sina2WordPressCore.py index 1354cfe..dbff346 100644 --- a/Sina2WordPressCore.py +++ b/Sina2WordPressCore.py @@ -94,8 +94,11 @@ def __init__(self, interface, sina_url, wordpress_admin, wordpress_url): msg = '(%d/%d) Analyzing Comment: %s' % (count, total, comment_url, ) interface.progress_update(msg, count, total) - comment_text, comment_id = comment_analyze( - comment_url, comment_id, sina_admin, wordpress_admin, wordpress_url) + try: + comment_text, comment_id = comment_analyze( + comment_url, comment_id, sina_admin, wordpress_admin, wordpress_url) + except: + break if comment_text: text.append(comment_text) @@ -180,7 +183,10 @@ def post_analyze(url, wordpress_admin): page = urlopen_request(request) #headers['Referer'] = url - post_title = content_clear(post_title_pattern.search(page).group(1)) + try: + post_title = content_clear(post_title_pattern.search(page).group(1)) + except: + return '','' post_time = post_time_pattern.search(page).group(1) post_content = content_clear(post_content_pattern.search(page).group(1))