Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/icoz/habraparse.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/habr
diff options
context:
space:
mode:
authoricoz <icoz.vt@gmail.com>2015-05-24 15:35:03 +0300
committericoz <icoz.vt@gmail.com>2015-05-24 15:35:03 +0300
commit11df6b8fb2a41b419627bf4a89b01d82c1ac6b51 (patch)
tree91dc080010600b82cd6d84622cd1ea450fddf919 /habr
parent06ad5a60347b1abe879c5a73089f959857ed942d (diff)
Fix issue #4
Добавлена корректная обработка даты регистрации readonly-пользователей.
Diffstat (limited to 'habr')
-rw-r--r--habr/user.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/habr/user.py b/habr/user.py
index 9b0576e..c70d424 100644
--- a/habr/user.py
+++ b/habr/user.py
@@ -151,7 +151,10 @@ class TMUser(object):
tmp = self._doc.xpath("//div[@class='user_profile']//dd/a[@class='city']")
self._user_profile['city'] = tmp[0].text if len(tmp) else ''
self._user_profile['people_tags'] = [i for i in map(lambda x: x.text, p_tags)]
- self._user_profile['registration_date'] = date_of_registration[:date_of_registration.index('\n')].strip()
+ try:
+ self._user_profile['registration_date'] = date_of_registration[:date_of_registration.index('\n')].strip()
+ except ValueError:
+ self._user_profile['registration_date'] = date_of_registration
self._user_profile['last_login_date'] = date_of_last_login[27:] if len(date_of_last_login) > 27 else ''
tmp = self._doc.xpath("//div[@class='stats']/div[@id='followers_count']/a")