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
cea5718e
Commit
cea5718e
authored
May 04, 2018
by
Francesco Poldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added proxy support
Fix for error func
parent
06ae8244
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
twint.py
twint.py
+32
-1
twint/config.py
twint/config.py
+3
-0
No files found.
twint.py
View file @
cea5718e
...
@@ -16,7 +16,7 @@ import argparse
...
@@ -16,7 +16,7 @@ import argparse
import
twint
import
twint
import
sys
import
sys
def
error
():
def
error
(
error
,
message
):
print
(
"[-] {}: {}"
.
format
(
error
,
message
))
print
(
"[-] {}: {}"
.
format
(
error
,
message
))
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -32,6 +32,31 @@ def check(args):
...
@@ -32,6 +32,31 @@ def check(args):
error
(
"Contradicting Args"
,
"--users and --tweets cannot be used together."
)
error
(
"Contradicting Args"
,
"--users and --tweets cannot be used together."
)
if
args
.
csv
and
args
.
output
is
None
:
if
args
.
csv
and
args
.
output
is
None
:
error
(
"Error"
,
"Please specify an output file (Example: -o file.csv)."
)
error
(
"Error"
,
"Please specify an output file (Example: -o file.csv)."
)
if
args
.
proxy_host
is
not
None
:
if
args
.
proxy_host
.
lower
()
==
"tor"
:
import
socks
,
socket
socks
.
set_default_proxy
(
socks
.
SOCKS5
,
"localhost"
,
9050
)
socket
.
socket
=
socks
.
socksocket
elif
args
.
proxy_port
and
args
.
proxy_type
:
if
args
.
proxy_type
.
lower
()
==
"socks5"
:
_type
=
socks
.
SOCKS5
elif
args
.
proxy_type
.
lower
()
==
"socks4"
:
_type
=
socks
.
SOCKS4
elif
args
.
proxy_type
.
lower
()
==
"http"
:
_type
=
socks
.
HTTP
else
:
error
(
"Error"
,
"Proxy type allower are: socks5, socks4 and http."
)
import
socks
,
socket
socks
.
set_default_proxy
(
_type
,
args
.
proxy_host
,
int
(
args
.
proxy_port
))
socket
.
socket
=
socks
.
socksocket
else
:
error
(
"Error"
,
"Please specify --proxy-host, --proxy-port and --proxy-type"
)
else
:
if
args
.
proxy_port
or
args
.
proxy_type
:
error
(
"Error"
,
"Please specify --proxy-host, --proxy-port and --proxy-type"
)
def
initialize
(
args
):
def
initialize
(
args
):
c
=
twint
.
Config
()
c
=
twint
.
Config
()
...
@@ -62,6 +87,9 @@ def initialize(args):
...
@@ -62,6 +87,9 @@ def initialize(args):
c
.
To
=
args
.
to
c
.
To
=
args
.
to
c
.
All
=
args
.
all
c
.
All
=
args
.
all
c
.
Debug
=
args
.
debug
c
.
Debug
=
args
.
debug
c
.
Proxy_type
=
args
.
proxy_type
c
.
Proxy_host
=
args
.
proxy_host
c
.
Proxy_port
=
args
.
proxy_port
return
c
return
c
def
options
():
def
options
():
...
@@ -96,6 +124,9 @@ def options():
...
@@ -96,6 +124,9 @@ def options():
ap
.
add_argument
(
"--following"
,
help
=
"Scrape who a person follows."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--following"
,
help
=
"Scrape who a person follows."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--favorites"
,
help
=
"Scrape Tweets a user has liked."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--favorites"
,
help
=
"Scrape Tweets a user has liked."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--debug"
,
help
=
"Debug mode"
,
action
=
"store_true"
)
ap
.
add_argument
(
"--debug"
,
help
=
"Debug mode"
,
action
=
"store_true"
)
ap
.
add_argument
(
"--proxy-type"
,
help
=
"Socks5, HTTP, etc."
)
ap
.
add_argument
(
"--proxy-host"
,
help
=
"Proxy hostname or IP"
)
ap
.
add_argument
(
"--proxy-port"
,
help
=
"The port of the proxy server"
)
args
=
ap
.
parse_args
()
args
=
ap
.
parse_args
()
return
args
return
args
...
...
twint/config.py
View file @
cea5718e
...
@@ -28,3 +28,6 @@ class Config:
...
@@ -28,3 +28,6 @@ class Config:
All
=
None
All
=
None
Debug
=
False
Debug
=
False
Format
=
None
Format
=
None
Proxy_type
=
None
Proxy_host
=
None
Proxy_port
=
None
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