Skip to content

Commit

Permalink
Merge pull request #87 from taspinar/tweet_html
Browse files Browse the repository at this point in the history
Tweet html
  • Loading branch information
taspinar authored Feb 2, 2018
2 parents 83e4cff + 07e8681 commit 7a36f16
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## 0.x.x

TBD
## 0.5.0 ( 2018-01-11 )
### Added
- Added the html code of a tweet message to the Tweet class as one of its attributes

## 0.4.2 ( 2018-01-09 )
### Fixed
- Fixed backward compatability of the new --lang parameter by placing it at the end of all arguments.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Per Tweet it scrapes the following information:
+ Tweet-id
+ Tweet-url
+ Tweet text
+ Tweet html
+ Tweet timestamp
+ No. of likes
+ No. of replies
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for anyone looking for older past data to make a model from. With
TwitterScraper there is no such limitation.

Per Tweet it scrapes the following information: + Username and Full Name
+ Tweet-id + Tweet-url + Tweet text + Tweet timestamp + No. of likes +
+ Tweet-id + Tweet-url + Tweet text + Tweet html + Tweet timestamp + No. of likes +
No. of replies + No. of retweets

2. Installation and Usage
Expand Down
6 changes: 5 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
## 0.x.x

TBD
## 0.4.2 ( 2018-01-9 )
## 0.5.0 ( 2018-01-11 )
### Added
- Added the html code of a tweet message to the Tweet class as one of its attributes

## 0.4.2 ( 2018-01-09 )
### Fixed
- Fixed backward compatability of the new --lang parameter by placing it at the end of all arguments.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='twitterscraper',
version='0.4.2',
version='0.5.0',
description='Tool for scraping Tweets',
url='https://github.com/taspinar/twitterscraper',
author=['Ahmet Taspinar', 'Lasse Schuirmann'],
Expand Down
4 changes: 3 additions & 1 deletion twitterscraper/tweet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@generate_ordering('timestamp', 'id', 'text', 'user', 'replies', 'retweets', 'likes')
class Tweet:
def __init__(self, user, fullname, id, url, timestamp, text, replies, retweets, likes):
def __init__(self, user, fullname, id, url, timestamp, text, replies, retweets, likes, html):
self.user = user
self.fullname = fullname
self.id = id
Expand All @@ -16,6 +16,7 @@ def __init__(self, user, fullname, id, url, timestamp, text, replies, retweets,
self.replies = replies
self.retweets = retweets
self.likes = likes
self.html = html

@classmethod
def from_soup(cls, tweet):
Expand All @@ -36,6 +37,7 @@ def from_soup(cls, tweet):
likes = tweet.find(
'span', 'ProfileTweet-action--favorite u-hiddenVisually').find(
'span', 'ProfileTweet-actionCount')['data-tweet-stat-count'] or '0',
html=tweet.find('p', 'tweet-text') or "",
)

@classmethod
Expand Down

0 comments on commit 7a36f16

Please sign in to comment.