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
32364fdf
Commit
32364fdf
authored
May 28, 2018
by
Cody Zacharias
Committed by
GitHub
May 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.1.3 Update
parent
9fa0154c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
20 deletions
+91
-20
twint/user.py
twint/user.py
+91
-20
No files found.
twint/user.py
View file @
32364fdf
class
User
:
id
=
""
username
=
""
name
=
""
bio
=
""
location
=
""
url
=
""
join_date
=
""
join_time
=
""
tweets
=
"0"
following
=
"0"
followers
=
"0"
likes
=
"0"
lists
=
"0"
media_count
=
""
is_private
=
False
is_verified
=
False
avatar
=
""
cover_photo
=
""
gif_avatar
=
False
class
user
:
pass
def
inf
(
ur
,
_type
):
try
:
group
=
ur
.
find
(
"div"
,
"user-actions btn-group not-following "
)
except
:
group
=
ur
.
find
(
"div"
,
"user-actions btn-group not-following protected"
)
if
_type
==
"id"
:
ret
=
group
[
"data-user-id"
]
elif
_type
==
"name"
:
ret
=
group
[
"data-name"
]
elif
_type
==
"username"
:
ret
=
group
[
"data-screen-name"
]
elif
_type
==
"private"
:
ret
=
group
[
"data-protected"
]
return
ret
def
card
(
ur
,
_type
):
if
_type
==
"bio"
:
try
:
ret
=
ur
.
find
(
"p"
,
"ProfileHeaderCard-bio u-dir"
)
.
text
.
replace
(
"
\n
"
,
" "
)
except
:
ret
=
"None"
elif
_type
==
"location"
:
try
:
ret
=
ur
.
find
(
"span"
,
"ProfileHeaderCard-locationText u-dir"
)
.
text
ret
=
ret
[
15
:]
.
replace
(
"
\n
"
,
" "
)[:
-
10
]
except
:
ret
=
"None"
elif
_type
==
"url"
:
try
:
ret
=
ur
.
find
(
"span"
,
"ProfileHeaderCard-urlText u-dir"
)
.
find
(
"a"
)[
"title"
]
except
:
ret
=
"None"
return
ret
def
join
(
ur
):
jd
=
ur
.
find
(
"span"
,
"ProfileHeaderCard-joinDateText js-tooltip u-dir"
)[
"title"
]
return
jd
.
split
(
" - "
)
def
stat
(
ur
,
_type
):
_class
=
"ProfileNav-item ProfileNav-item--{}"
.
format
(
_type
)
stat
=
ur
.
find
(
"li"
,
_class
)
return
stat
.
find
(
"span"
,
"ProfileNav-value"
)[
"data-count"
]
def
media
(
ur
):
try
:
media_count
=
ur
.
find
(
"a"
,
"PhotoRail-headingWithCount js-nav"
)
.
text
media_count
=
media_count
.
replace
(
"
\n
"
,
""
)[
32
:]
.
split
(
" "
)[
0
]
except
:
media_count
=
"0"
return
media_count
def
verified
(
ur
):
try
:
is_verified
=
ur
.
find
(
"span"
,
"ProfileHeaderCard-badges"
)
.
text
if
"Verified account"
in
is_verified
:
is_verified
=
"true"
else
:
is_verified
=
"false"
except
:
is_verified
=
"false"
return
is_verified
def
User
(
ur
):
u
=
user
()
for
img
in
ur
.
findAll
(
"img"
,
"Emoji Emoji--forText"
):
img
.
replaceWith
(
"<{}>"
.
format
(
img
[
'aria-label'
]))
u
.
id
=
inf
(
ur
,
"id"
)
u
.
name
=
inf
(
ur
,
"name"
)
u
.
username
=
inf
(
ur
,
"username"
)
u
.
bio
=
card
(
ur
,
"bio"
)
u
.
location
=
card
(
ur
,
"location"
)
u
.
url
=
card
(
ur
,
"url"
)
u
.
join_date
=
join
(
ur
)[
1
]
u
.
join_time
=
join
(
ur
)[
0
]
u
.
tweets
=
stat
(
ur
,
"tweets is-active"
)
u
.
following
=
stat
(
ur
,
"following"
)
u
.
followers
=
stat
(
ur
,
"followers"
)
u
.
likes
=
stat
(
ur
,
"favorites"
)
u
.
media_count
=
media
(
ur
)
u
.
is_private
=
inf
(
ur
,
"private"
)
u
.
is_verified
=
verified
(
ur
)
u
.
avatar
=
ur
.
find
(
"img"
,
"ProfileAvatar-image"
)[
"src"
]
return
u
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