Skip to content

Commit 7a36f16

Browse files
authored
Merge pull request #87 from taspinar/tweet_html
Tweet html
2 parents 83e4cff + 07e8681 commit 7a36f16

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

HISTORY.rst

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
## 0.x.x
44

55
TBD
6+
## 0.5.0 ( 2018-01-11 )
7+
### Added
8+
- Added the html code of a tweet message to the Tweet class as one of its attributes
9+
610
## 0.4.2 ( 2018-01-09 )
711
### Fixed
812
- Fixed backward compatability of the new --lang parameter by placing it at the end of all arguments.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Per Tweet it scrapes the following information:
3131
+ Tweet-id
3232
+ Tweet-url
3333
+ Tweet text
34+
+ Tweet html
3435
+ Tweet timestamp
3536
+ No. of likes
3637
+ No. of replies

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ for anyone looking for older past data to make a model from. With
3131
TwitterScraper there is no such limitation.
3232

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

3737
2. Installation and Usage

changelog.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
## 0.x.x
44

55
TBD
6-
## 0.4.2 ( 2018-01-9 )
6+
## 0.5.0 ( 2018-01-11 )
7+
### Added
8+
- Added the html code of a tweet message to the Tweet class as one of its attributes
9+
10+
## 0.4.2 ( 2018-01-09 )
711
### Fixed
812
- Fixed backward compatability of the new --lang parameter by placing it at the end of all arguments.
913

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='twitterscraper',
11-
version='0.4.2',
11+
version='0.5.0',
1212
description='Tool for scraping Tweets',
1313
url='https://github.com/taspinar/twitterscraper',
1414
author=['Ahmet Taspinar', 'Lasse Schuirmann'],

twitterscraper/tweet.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
@generate_ordering('timestamp', 'id', 'text', 'user', 'replies', 'retweets', 'likes')
88
class Tweet:
9-
def __init__(self, user, fullname, id, url, timestamp, text, replies, retweets, likes):
9+
def __init__(self, user, fullname, id, url, timestamp, text, replies, retweets, likes, html):
1010
self.user = user
1111
self.fullname = fullname
1212
self.id = id
@@ -16,6 +16,7 @@ def __init__(self, user, fullname, id, url, timestamp, text, replies, retweets,
1616
self.replies = replies
1717
self.retweets = retweets
1818
self.likes = likes
19+
self.html = html
1920

2021
@classmethod
2122
def from_soup(cls, tweet):
@@ -36,6 +37,7 @@ def from_soup(cls, tweet):
3637
likes = tweet.find(
3738
'span', 'ProfileTweet-action--favorite u-hiddenVisually').find(
3839
'span', 'ProfileTweet-actionCount')['data-tweet-stat-count'] or '0',
40+
html=tweet.find('p', 'tweet-text') or "",
3941
)
4042

4143
@classmethod

0 commit comments

Comments
 (0)