Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
Twint
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Twint
Commits
894655fd
Commit
894655fd
authored
Aug 12, 2019
by
Francesco Poldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retweet information enrichment and added reply_to
parent
d376bbd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
twint/tweet.py
twint/tweet.py
+11
-9
No files found.
twint/tweet.py
View file @
894655fd
...
...
@@ -54,12 +54,16 @@ def getStat(tw, _type):
st
=
f
"ProfileTweet-action--{_type} u-hiddenVisually"
return
tw
.
find
(
"span"
,
st
)
.
find
(
"span"
)[
"data-tweet-stat-count"
]
def
getRetweet
(
profile
,
username
,
user
):
def
getRetweet
(
tw
):
"""Get Retweet
"""
logme
.
debug
(
__name__
+
':getRetweet'
)
if
profile
and
username
.
lower
()
!=
user
.
lower
():
return
1
_rt_object
=
tw
.
find
(
'span'
,
'js-retweet-text'
)
if
_rt_object
:
_rt_id
=
_rt_object
.
find
(
'a'
)[
'data-user-id'
]
_rt_username
=
_rt_object
.
find
(
'a'
)[
'href'
][
1
:]
return
_rt_id
,
_rt_username
return
''
,
''
def
Tweet
(
tw
,
config
):
"""Create Tweet object
...
...
@@ -91,14 +95,12 @@ def Tweet(tw, config):
t
.
retweets_count
=
getStat
(
tw
,
"retweet"
)
t
.
likes_count
=
getStat
(
tw
,
"favorite"
)
t
.
link
=
f
"https://twitter.com/{t.username}/status/{t.id}"
t
.
retweet
=
getRetweet
(
config
.
Profile
,
t
.
username
,
config
.
Username
)
if
t
.
retweet
or
config
.
Native_retweets
:
t
.
retweet
=
True
t
.
user_rt_id
=
config
.
User_id
else
:
t
.
user_rt_id
=
0
t
.
user_rt_id
,
t
.
user_rt
=
getRetweet
(
tw
)
t
.
retweet
=
True
if
t
.
user_rt
else
False
t
.
retweet_id
=
tw
[
'data-retweet-id'
]
if
t
.
user_rt
else
''
t
.
quote_url
=
getQuoteURL
(
tw
)
t
.
near
=
config
.
Near
if
config
.
Near
else
""
t
.
geo
=
config
.
Geo
if
config
.
Geo
else
""
t
.
source
=
config
.
Source
if
config
.
Source
else
""
t
.
reply_to
=
[{
'user_id'
:
t
[
'id_str'
],
'username'
:
t
[
'screen_name'
]}
for
t
in
json
.
loads
(
tw
[
"data-reply-to-users-json"
])]
return
t
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment