diff --git a/README.md b/README.md index 98a9497..b4623fe 100644 --- a/README.md +++ b/README.md @@ -115,11 +115,10 @@ 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, user_id: "1019138658"} +{'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'} ``` - ## Contributing to twitter-scraper To contribute to twitter-scraper, follow these steps: @@ -135,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 ffd3f2e..841f068 100644 --- a/twitter_scraper/modules/profile.py +++ b/twitter_scraper/modules/profile.py @@ -23,8 +23,9 @@ class Profile: - following_count - is_verified - is_private + - joined_date - user_id - """ + """ def __init__(self, username): headers = { @@ -66,6 +67,10 @@ def __parse_profile(self, page): if not self.location: 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: self.birthday = self.birthday.replace("Born ", "") @@ -136,6 +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, user_id=self.user_id ) @@ -155,6 +161,7 @@ def __dir__(self): "following_count", "is_verified", "is_private", + "joined_date", "user_id" ]