From bf039e88b539eeae45eff933d20bd09d2f822832 Mon Sep 17 00:00:00 2001 From: ozan bayram Date: Tue, 23 Jun 2020 16:26:45 +0300 Subject: [PATCH 1/4] added new attribute called joined_date --- twitter_scraper/modules/profile.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/twitter_scraper/modules/profile.py b/twitter_scraper/modules/profile.py index 76dc84e..a4948a4 100644 --- a/twitter_scraper/modules/profile.py +++ b/twitter_scraper/modules/profile.py @@ -23,6 +23,8 @@ class Profile: - following_count - is_verified - is_private + -joined_date + """ def __init__(self, username): @@ -65,6 +67,9 @@ def __parse_profile(self, page): if not self.location: self.location = None + self.joined_date = html.find(".ProfileHeaderCard-joinDateText")[0].text.replace('Joined ', '') + + self.birthday = html.find(".ProfileHeaderCard-birthdateText")[0].text if self.birthday: self.birthday = self.birthday.replace("Born ", "") @@ -133,6 +138,7 @@ def to_dict(self): following_count=self.following_count, is_verified=self.is_verified, is_private=self.is_private, + joined_date=self.joined_date ) def __dir__(self): @@ -150,7 +156,8 @@ def __dir__(self): "followers_count", "following_count", "is_verified", - "is_private" + "is_private", + "joined_date", ] def __repr__(self): From 5a30989ff2701f046bd08fdfe29de51e8065c517 Mon Sep 17 00:00:00 2001 From: ozanbayram <39274514+ozanbayram@users.noreply.github.com> Date: Tue, 23 Jun 2020 16:32:00 +0300 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bbb2f4..8ee55c5 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Type "help", "copyright", "credits" or "license" for more information. >>> from twitter_scraper import Profile >>> profile = Profile("bugraisguzar") >>> profile.to_dict() -{'name': 'Buğra İşgüzar', 'username': 'bugraisguzar', 'birthday': None, 'biography': 'geliştirici@peptr', 'website': 'bisguzar.com', 'profile_photo': 'https://pbs.twimg.com/profile_images/1199305322474745861/nByxOcDZ_400x400.jpg', 'banner_photo': 'https://pbs.twimg.com/profile_banners/1019138658/1555346657/1500x500', 'likes_count': 2512, 'tweets_count': 756, 'followers_count': 483, 'following_count': 255, 'is_verified': False, 'is_private': False} +{'name': 'Buğra İşgüzar', 'username': 'bugraisguzar', 'birthday': None, 'biography': 'geliştirici@peptr', 'website': 'bisguzar.com', 'profile_photo': 'https://pbs.twimg.com/profile_images/1199305322474745861/nByxOcDZ_400x400.jpg', 'banner_photo': 'https://pbs.twimg.com/profile_banners/1019138658/1555346657/1500x500', 'likes_count': 2512, 'tweets_count': 756, 'followers_count': 483, 'following_count': 255, 'is_verified': False, 'is_private': False, 'joined_date': 'December 2012'} ``` From 5dbece6d817ca122448f0466e48ddde9bfb8a975 Mon Sep 17 00:00:00 2001 From: ozanbayram <39274514+ozanbayram@users.noreply.github.com> Date: Mon, 29 Jun 2020 18:44:25 +0300 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ee55c5..85e8dc8 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Type "help", "copyright", "credits" or "license" for more information. >>> from twitter_scraper import Profile >>> profile = Profile("bugraisguzar") >>> profile.to_dict() -{'name': 'Buğra İşgüzar', 'username': 'bugraisguzar', 'birthday': None, 'biography': 'geliştirici@peptr', 'website': 'bisguzar.com', 'profile_photo': 'https://pbs.twimg.com/profile_images/1199305322474745861/nByxOcDZ_400x400.jpg', 'banner_photo': 'https://pbs.twimg.com/profile_banners/1019138658/1555346657/1500x500', 'likes_count': 2512, 'tweets_count': 756, 'followers_count': 483, 'following_count': 255, 'is_verified': False, 'is_private': False, 'joined_date': 'December 2012'} +{'name': 'Buğra İşgüzar', 'username': 'bugraisguzar', 'birthday': None, 'biography': 'geliştirici@peptr', 'website': 'bisguzar.com', 'profile_photo': 'https://pbs.twimg.com/profile_images/1199305322474745861/nByxOcDZ_400x400.jpg', 'banner_photo': 'https://pbs.twimg.com/profile_banners/1019138658/1555346657/1500x500', 'likes_count': 2512, 'tweets_count': 756, 'followers_count': 483, 'following_count': 255, 'is_verified': False, 'is_private': False, 'user_id': '1019138658', 'joined_date': 'December 2012'} ``` From 14dd9701410d58989621f19695c35c9122f57639 Mon Sep 17 00:00:00 2001 From: Ozan Bayram Date: Thu, 23 Jul 2020 14:05:31 +0300 Subject: [PATCH 4/4] check other case --- README.md | 2 +- twitter_scraper/modules/profile.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2204fe1..b4623fe 100644 --- a/README.md +++ b/README.md @@ -134,9 +134,9 @@ Alternatively see the GitHub documentation on [creating a pull request](https:// Thanks to the following people who have contributed to this project: -* @kennethreitz (author) * @bisguzar (maintainer) * @lionking6792 +* @kennethreitz (author) * @ozanbayram * @xeliot diff --git a/twitter_scraper/modules/profile.py b/twitter_scraper/modules/profile.py index aff975d..841f068 100644 --- a/twitter_scraper/modules/profile.py +++ b/twitter_scraper/modules/profile.py @@ -23,7 +23,7 @@ class Profile: - following_count - is_verified - is_private - -joined_date + - joined_date - user_id """ @@ -68,7 +68,8 @@ def __parse_profile(self, page): self.location = None self.joined_date = html.find(".ProfileHeaderCard-joinDateText")[0].text.replace('Joined ', '') - + if not self.joined_date: + self.joined_date = None self.birthday = html.find(".ProfileHeaderCard-birthdateText")[0].text if self.birthday: @@ -140,7 +141,7 @@ def to_dict(self): following_count=self.following_count, is_verified=self.is_verified, is_private=self.is_private, - joined_date=self.joined_date + joined_date=self.joined_date, user_id=self.user_id )