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
a869fcdb
Commit
a869fcdb
authored
Oct 25, 2018
by
Maxim Gubin
Committed by
Francesco Poldi
Oct 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix repeating set of tweets load #250 (#252)
* New twitter scheme * Fix minor mistake * Fix location issue
parent
83bec238
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
44 deletions
+46
-44
twint/feed.py
twint/feed.py
+1
-4
twint/get.py
twint/get.py
+11
-11
twint/run.py
twint/run.py
+1
-1
twint/url.py
twint/url.py
+33
-28
No files found.
twint/feed.py
View file @
a869fcdb
...
...
@@ -43,7 +43,4 @@ def Json(response):
html
=
json_response
[
"items_html"
]
soup
=
BeautifulSoup
(
html
,
"html.parser"
)
feed
=
soup
.
find_all
(
"li"
,
"js-stream-item"
)
split
=
json_response
[
"min_position"
]
.
split
(
"-"
)
split
[
1
]
=
feed
[
-
1
][
"data-item-id"
]
return
feed
,
"-"
.
join
(
split
)
return
feed
,
json_response
[
"min_position"
]
twint/get.py
View file @
a869fcdb
...
...
@@ -53,8 +53,8 @@ async def RequestUrl(config, init):
_url
=
await
url
.
Profile
(
config
.
Username
,
init
)
response
=
await
Request
(
_url
,
connector
=
_connector
)
elif
config
.
TwitterSearch
:
_url
=
await
url
.
Search
(
config
,
init
)
response
=
await
Request
(
_url
,
connector
=
_connector
)
_url
,
params
=
await
url
.
Search
(
config
,
init
)
response
=
await
Request
(
_url
,
params
=
params
,
connector
=
_connector
)
else
:
if
config
.
Following
:
_url
=
await
url
.
Following
(
config
.
Username
,
init
)
...
...
@@ -71,27 +71,27 @@ async def RequestUrl(config, init):
async
def
MobileRequest
(
url
,
**
options
):
#loggin.info("[<] " + str(datetime.now()) + ':: get+MobileRequest')
ua
=
{
'User-Agent'
:
'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/0.8.12'
}
connector
=
options
.
get
(
"connector"
)
if
connector
:
async
with
aiohttp
.
ClientSession
(
headers
=
ua
,
connector
=
connector
)
as
session
:
async
with
aiohttp
.
ClientSession
(
connector
=
connector
)
as
session
:
return
await
Response
(
session
,
url
)
async
with
aiohttp
.
ClientSession
(
headers
=
ua
)
as
session
:
async
with
aiohttp
.
ClientSession
()
as
session
:
return
await
Response
(
session
,
url
)
async
def
Request
(
url
,
**
options
):
async
def
Request
(
url
,
connector
=
None
,
params
=
[]):
#loggin.info("[<] " + str(datetime.now()) + ':: get+Request')
connector
=
options
.
get
(
"connector"
)
if
connector
:
async
with
aiohttp
.
ClientSession
(
connector
=
connector
)
as
session
:
return
await
Response
(
session
,
url
)
return
await
Response
(
session
,
url
,
params
)
async
with
aiohttp
.
ClientSession
()
as
session
:
return
await
Response
(
session
,
url
)
return
await
Response
(
session
,
url
,
params
)
async
def
Response
(
session
,
url
):
async
def
Response
(
session
,
url
,
params
=
[]
):
#loggin.info("[<] " + str(datetime.now()) + ':: get+Response')
headers
=
{
'User-Agent'
:
'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/0.8.12'
}
with
timeout
(
30
):
async
with
session
.
get
(
url
,
ssl
=
False
)
as
response
:
async
with
session
.
get
(
url
,
ssl
=
False
,
headers
=
headers
,
params
=
params
)
as
response
:
return
await
response
.
text
()
async
def
Username
(
_id
):
...
...
twint/run.py
View file @
a869fcdb
...
...
@@ -11,7 +11,7 @@ class Twint:
if
config
.
Resume
is
not
None
and
config
.
TwitterSearch
:
self
.
init
=
f
"TWEET-{config.Resume}-0"
else
:
self
.
init
=
-
1
self
.
init
=
"-1"
self
.
feed
=
[
-
1
]
self
.
count
=
0
self
.
config
=
config
...
...
twint/url.py
View file @
a869fcdb
...
...
@@ -53,49 +53,54 @@ async def Profile(username, init):
async
def
Search
(
config
,
init
):
#logging.info("[<] " + str(datetime.now()) + ':: url+Search')
url
=
f
"{base}/search/timeline?f=tweets&vertical=default&lang=en"
url
+=
"&include_available_features=1&include_entities=1&"
url
+=
f
"reset_error_state=false&src=typd&qf=off&max_position={init}&q="
url
=
f
"{base}/search/timeline"
params
=
[
(
'f'
,
'tweets'
),
(
'vertical'
,
'default'
),
(
'src'
,
'unkn'
),
(
'include_available_features'
,
'1'
),
(
'include_entities'
,
'1'
),
(
'max_position'
,
init
),
(
'reset_error_state'
,
'false'
),
]
q
=
""
if
config
.
Lang
:
url
=
url
.
replace
(
"lang=en"
,
f
"l={config.Lang}&lang=en"
)
params
.
append
((
"l"
,
config
.
Lang
))
params
.
append
((
"lang"
,
"en"
))
if
config
.
Username
:
url
+=
f
"from
%3
A
{config.Username}"
q
+=
f
"from:
{config.Username}"
if
config
.
Geo
:
config
.
Geo
=
config
.
Geo
.
replace
(
" "
,
""
)
url
+=
f
"geocode
%3
A
{config.Geo}"
q
+=
f
"geocode:
{config.Geo}"
if
config
.
Search
:
config
.
Search
=
config
.
Search
.
replace
(
" "
,
"
%20
"
)
config
.
Search
=
config
.
Search
.
replace
(
"#"
,
"
%23
"
)
url
+=
f
"
%20
{config.Search}"
q
+=
f
"{config.Search}"
if
config
.
Year
:
url
+=
f
"
%20
until
%3
A
{config.Year}-1-1"
q
+=
f
" until:
{config.Year}-1-1"
if
config
.
Since
:
url
+=
f
"
%20
since
%3
A
{config.Since}"
q
+=
f
" since:
{config.Since}"
if
config
.
Until
:
url
+=
f
"
%20
until
%3
A
{config.Until}"
q
+=
f
" until:
{config.Until}"
if
config
.
Fruit
:
url
+=
"
%20%22
myspace.com
%22%20
OR
%20%22
last.fm
%22%20
OR"
url
+=
"
%20%22
mail
%22%20
OR
%20%22
email
%22%20
OR
%20%22
gmail
%22%20
OR
%20%22
e-mail
%22
"
url
+=
"
%20
OR
%20%22
phone
%22%20
OR
%20%22
call
%20
me
%22%20
OR
%20%22
text
%20
me
%22
"
url
+=
"
%20
OR
%20%22
keybase
%22
"
url
+=
' "myspace.com" OR "last.fm" OR'
url
+=
' "mail" OR "email" OR "gmail" OR "e-mail"'
#
url += "%20OR%20%22phone%22%20OR%20%22call%20me%22%20OR%20%22text%20me%22"
#
url += "%20OR%20%22keybase%22"
if
config
.
Verified
:
url
+=
"
%20
filter
%3
A
verified"
q
+=
" filter:
verified"
if
config
.
To
:
url
+=
f
"
%20
to
%3
A
{config.To}"
q
+=
f
" to:
{config.To}"
if
config
.
All
:
url
+=
f
"
%20
to
%3
A{config.All}
%20
OR
%20
from
%3
A{config.All}
%20
OR
%20
@{config.All}"
q
+=
f
" to:{config.All} OR from:{config.All} OR
@{config.All}"
if
config
.
Near
:
config
.
Near
=
config
.
Near
.
replace
(
" "
,
"
%20
"
)
config
.
Near
=
config
.
Near
.
replace
(
","
,
"
%2
C"
)
url
+=
f
"
%20
near
%3
A
%22
{config.Near}
%22
"
q
+=
f
' near:"{config.Near}"'
if
config
.
Images
:
url
+=
"
%20
filter
%3
A
images"
q
+=
" filter:
images"
if
config
.
Videos
:
url
+=
"
%20
filter
%3
A
videos"
q
+=
" filter:
videos"
if
config
.
Media
:
url
+=
"
%20
filter
%3
A
media"
q
+=
" filter:
media"
if
config
.
Replies
:
url
+=
"
%20
filter
%3
A
replies"
q
+=
" filter:
replies"
return
url
params
.
append
((
"q"
,
q
))
return
url
,
params
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