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
bf9e9693
Commit
bf9e9693
authored
May 31, 2018
by
Francesco Poldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Profile option for userlist #124
parent
7a43f9a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
Twint.py
Twint.py
+17
-10
No files found.
Twint.py
View file @
bf9e9693
...
@@ -31,7 +31,7 @@ def check(args):
...
@@ -31,7 +31,7 @@ def check(args):
error
(
"Error"
,
"Please specify an output file (Example: -o file.csv)."
)
error
(
"Error"
,
"Please specify an output file (Example: -o file.csv)."
)
elif
args
.
json
:
elif
args
.
json
:
error
(
"Error"
,
"Please specify an output file (Example: -o file.json)."
)
error
(
"Error"
,
"Please specify an output file (Example: -o file.json)."
)
if
not
args
.
followers
and
not
args
.
following
:
if
not
args
.
followers
and
not
args
.
following
:
if
args
.
user_full
:
if
args
.
user_full
:
error
(
"Error"
,
"Please use --user-full with --followers or --following."
)
error
(
"Error"
,
"Please use --user-full with --followers or --following."
)
...
@@ -60,15 +60,18 @@ def check(args):
...
@@ -60,15 +60,18 @@ def check(args):
if
args
.
proxy_port
or
args
.
proxy_type
:
if
args
.
proxy_port
or
args
.
proxy_type
:
error
(
"Error"
,
"Please specify --proxy-host, --proxy-port, and --proxy-type"
)
error
(
"Error"
,
"Please specify --proxy-host, --proxy-port, and --proxy-type"
)
def
loadUserList
(
ul
):
def
loadUserList
(
ul
,
type
):
if
os
.
path
.
exists
(
os
.
path
.
abspath
(
ul
)):
if
os
.
path
.
exists
(
os
.
path
.
abspath
(
ul
)):
userlist
=
open
(
os
.
path
.
abspath
(
ul
),
"r"
)
.
read
()
.
splitlines
()
userlist
=
open
(
os
.
path
.
abspath
(
ul
),
"r"
)
.
read
()
.
splitlines
()
else
:
else
:
userlist
=
ul
.
split
(
","
)
userlist
=
ul
.
split
(
","
)
un
=
""
if
type
==
"search"
:
for
user
in
userlist
:
un
=
""
un
+=
"
%20
OR
%20
from
%3
A"
+
user
for
user
in
userlist
:
return
un
[
15
:]
un
+=
"
%20
OR
%20
from
%3
A"
+
user
return
un
[
15
:]
else
:
return
userlist
def
initialize
(
args
):
def
initialize
(
args
):
c
=
twint
.
Config
()
c
=
twint
.
Config
()
...
@@ -119,7 +122,7 @@ def options():
...
@@ -119,7 +122,7 @@ def options():
ap
.
add_argument
(
"--since"
,
help
=
"Filter Tweets sent since date (Example: 2017-12-27)."
)
ap
.
add_argument
(
"--since"
,
help
=
"Filter Tweets sent since date (Example: 2017-12-27)."
)
ap
.
add_argument
(
"--until"
,
help
=
"Filter Tweets sent until date (Example: 2017-12-27)."
)
ap
.
add_argument
(
"--until"
,
help
=
"Filter Tweets sent until date (Example: 2017-12-27)."
)
ap
.
add_argument
(
"--fruit"
,
help
=
"Display 'low-hanging-fruit' Tweets."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--fruit"
,
help
=
"Display 'low-hanging-fruit' Tweets."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--verified"
,
help
=
"Display Tweets only from verified users (Use with -s)."
,
ap
.
add_argument
(
"--verified"
,
help
=
"Display Tweets only from verified users (Use with -s)."
,
action
=
"store_true"
)
action
=
"store_true"
)
ap
.
add_argument
(
"--csv"
,
help
=
"Write as .csv file."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--csv"
,
help
=
"Write as .csv file."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--json"
,
help
=
"Write as .json file"
,
action
=
"store_true"
)
ap
.
add_argument
(
"--json"
,
help
=
"Write as .json file"
,
action
=
"store_true"
)
...
@@ -144,7 +147,7 @@ def options():
...
@@ -144,7 +147,7 @@ def options():
ap
.
add_argument
(
"--format"
,
help
=
"Custom output format (See wiki for details)."
)
ap
.
add_argument
(
"--format"
,
help
=
"Custom output format (See wiki for details)."
)
ap
.
add_argument
(
"--user-full"
,
help
=
"Collect all user information (Use with followers or following only)."
,
ap
.
add_argument
(
"--user-full"
,
help
=
"Collect all user information (Use with followers or following only)."
,
action
=
"store_true"
)
action
=
"store_true"
)
ap
.
add_argument
(
"--profile-full"
,
ap
.
add_argument
(
"--profile-full"
,
help
=
"Slow, but effective method of collecting a user's Tweets (Including Retweets)."
,
help
=
"Slow, but effective method of collecting a user's Tweets (Including Retweets)."
,
action
=
"store_true"
)
action
=
"store_true"
)
args
=
ap
.
parse_args
()
args
=
ap
.
parse_args
()
...
@@ -155,7 +158,7 @@ def main():
...
@@ -155,7 +158,7 @@ def main():
check
(
args
)
check
(
args
)
if
args
.
userlist
:
if
args
.
userlist
:
args
.
username
=
loadUserList
(
args
.
userlist
)
args
.
username
=
loadUserList
(
args
.
userlist
,
"search"
)
c
=
initialize
(
args
)
c
=
initialize
(
args
)
...
@@ -166,7 +169,11 @@ def main():
...
@@ -166,7 +169,11 @@ def main():
elif
args
.
followers
:
elif
args
.
followers
:
twint
.
run
.
Followers
(
c
)
twint
.
run
.
Followers
(
c
)
elif
args
.
retweets
or
args
.
profile_full
:
elif
args
.
retweets
or
args
.
profile_full
:
twint
.
run
.
Profile
(
c
)
_userlist
=
loadUserList
(
args
.
userlist
,
"profile"
)
for
_user
in
_userlist
:
args
.
username
=
_user
c
=
initialize
(
args
)
twint
.
run
.
Profile
(
c
)
else
:
else
:
twint
.
run
.
Search
(
c
)
twint
.
run
.
Search
(
c
)
...
...
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