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
01e9b7f7
Commit
01e9b7f7
authored
Nov 01, 2019
by
Francesco Poldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned code
parent
daea5fb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
twint/get.py
twint/get.py
+6
-16
No files found.
twint/get.py
View file @
01e9b7f7
...
...
@@ -90,21 +90,20 @@ async def RequestUrl(config, init, headers = []):
logme
.
debug
(
__name__
+
':RequestUrl'
)
_connector
=
get_connector
(
config
)
_serialQuery
=
""
params
=
[]
_url
=
""
if
config
.
Profile
:
if
config
.
Profile_full
:
logme
.
debug
(
__name__
+
':RequestUrl:Profile_full'
)
_url
=
await
url
.
MobileProfile
(
config
.
Username
,
init
)
response
=
await
MobileRequest
(
_url
,
connector
=
_connector
,
headers
=
headers
)
else
:
logme
.
debug
(
__name__
+
':RequestUrl:notProfile_full'
)
_url
=
await
url
.
Profile
(
config
.
Username
,
init
)
response
=
await
Request
(
_url
,
connector
=
_connector
,
headers
=
headers
)
_serialQuery
=
_url
elif
config
.
TwitterSearch
:
logme
.
debug
(
__name__
+
':RequestUrl:TwitterSearch'
)
_url
,
params
,
_serialQuery
=
await
url
.
Search
(
config
,
init
)
response
=
await
Request
(
_url
,
params
=
params
,
connector
=
_connector
,
headers
=
headers
)
else
:
if
config
.
Following
:
logme
.
debug
(
__name__
+
':RequestUrl:Following'
)
...
...
@@ -115,24 +114,15 @@ async def RequestUrl(config, init, headers = []):
else
:
logme
.
debug
(
__name__
+
':RequestUrl:Favorites'
)
_url
=
await
url
.
Favorites
(
config
.
Username
,
init
)
response
=
await
MobileRequest
(
_url
,
connector
=
_connector
,
headers
=
headers
)
_serialQuery
=
_url
response
=
await
Request
(
_url
,
params
=
params
,
connector
=
_connector
,
headers
=
headers
)
if
config
.
Debug
:
print
(
_serialQuery
,
file
=
open
(
"twint-request_urls.log"
,
"a"
,
encoding
=
"utf-8"
))
return
response
async
def
MobileRequest
(
url
,
headers
,
**
options
):
connector
=
options
.
get
(
"connector"
)
if
connector
:
logme
.
debug
(
__name__
+
':MobileRequest:Connector'
)
async
with
aiohttp
.
ClientSession
(
connector
=
connector
,
headers
=
headers
)
as
session
:
return
await
Response
(
session
,
url
)
logme
.
debug
(
__name__
+
':MobileRequest:notConnector'
)
async
with
aiohttp
.
ClientSession
(
headers
=
headers
)
as
session
:
return
await
Response
(
session
,
url
)
def
ForceNewTorIdentity
(
config
):
logme
.
debug
(
__name__
+
':ForceNewTorIdentity'
)
try
:
...
...
@@ -153,13 +143,13 @@ async def Request(url, connector=None, params=[], headers=[]):
async
with
aiohttp
.
ClientSession
(
connector
=
connector
,
headers
=
headers
)
as
session
:
return
await
Response
(
session
,
url
,
params
)
logme
.
debug
(
__name__
+
':Request:notConnector'
)
async
with
aiohttp
.
ClientSession
(
headers
=
headers
)
as
session
:
async
with
aiohttp
.
ClientSession
(
headers
=
headers
,
connector
=
None
)
as
session
:
return
await
Response
(
session
,
url
,
params
)
async
def
Response
(
session
,
url
,
params
=
[]):
logme
.
debug
(
__name__
+
':Response'
)
with
timeout
(
100
):
async
with
session
.
get
(
url
,
ssl
=
Fals
e
,
params
=
params
,
proxy
=
httpproxy
)
as
response
:
async
with
session
.
get
(
url
,
ssl
=
Tru
e
,
params
=
params
,
proxy
=
httpproxy
)
as
response
:
return
await
response
.
text
()
async
def
RandomUserAgent
():
...
...
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