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
a866e745
Commit
a866e745
authored
Aug 10, 2019
by
Francesco Poldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added source field
parent
454c2d39
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
25 deletions
+21
-25
twint/cli.py
twint/cli.py
+2
-0
twint/storage/db.py
twint/storage/db.py
+3
-1
twint/storage/elasticsearch.py
twint/storage/elasticsearch.py
+4
-1
twint/storage/panda.py
twint/storage/panda.py
+4
-11
twint/storage/write_meta.py
twint/storage/write_meta.py
+7
-12
twint/tweet.py
twint/tweet.py
+1
-0
No files found.
twint/cli.py
View file @
a866e745
...
...
@@ -120,6 +120,7 @@ def initialize(args):
c
.
Min_retweets
=
args
.
min_retweets
c
.
Min_replies
=
args
.
min_replies
c
.
Links
=
args
.
links
c
.
Source
=
args
.
source
return
c
def
options
():
...
...
@@ -211,6 +212,7 @@ def options():
ap
.
add_argument
(
"--min-replies"
,
help
=
"Filter the tweets by minimum number of replies."
)
ap
.
add_argument
(
"--links"
,
help
=
"Include or exclude tweets containing one o more links. If not specified"
+
" you will get both tweets that might contain links or not."
)
ap
.
add_argument
(
"--source"
,
help
=
"Filter the tweets for specific source client."
)
args
=
ap
.
parse_args
()
return
args
...
...
twint/storage/db.py
View file @
a866e745
...
...
@@ -77,6 +77,7 @@ def init(db):
video integer,
geo text,
near text,
source text,
time_update integer not null,
PRIMARY KEY (id)
);
...
...
@@ -246,8 +247,9 @@ def tweets(conn, Tweet, config):
Tweet
.
video
,
Tweet
.
geo
,
Tweet
.
near
,
Tweet
.
source
,
time_ms
)
cursor
.
execute
(
'INSERT INTO tweets VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
,
entry
)
cursor
.
execute
(
'INSERT INTO tweets VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
,?
)'
,
entry
)
if
config
.
Favorites
:
query
=
'INSERT INTO favorites VALUES(?,?)'
...
...
twint/storage/elasticsearch.py
View file @
a866e745
...
...
@@ -87,7 +87,8 @@ def createIndex(config, instance, **scope):
"geo_tweet"
:
{
"type"
:
"geo_point"
},
"photos"
:
{
"type"
:
"text"
},
"user_rt_id"
:
{
"type"
:
"integer"
},
"mentions"
:
{
"type"
:
"keyword"
}
"mentions"
:
{
"type"
:
"keyword"
},
"source"
:
{
"type"
:
"keyword"
}
}
},
"settings"
:
{
...
...
@@ -247,6 +248,8 @@ def Tweet(Tweet, config):
_t_place
=
getLocation
(
Tweet
.
place
)
if
_t_place
:
j_data
[
"_source"
]
.
update
({
"geo_tweet"
:
getLocation
(
Tweet
.
place
)})
if
Tweet
.
source
:
j_data
[
"_source"
]
.
update
({
"source"
:
Tweet
.
Source
})
actions
.
append
(
j_data
)
es
=
Elasticsearch
(
config
.
Elasticsearch
,
verify_certs
=
config
.
Skip_certs
)
...
...
twint/storage/panda.py
View file @
a866e745
...
...
@@ -89,18 +89,11 @@ def update(object, config):
"nretweets"
:
int
(
Tweet
.
retweets_count
),
"quote_url"
:
Tweet
.
quote_url
,
"search"
:
str
(
config
.
Search
),
"near"
:
config
.
Near
"near"
:
Tweet
.
near
,
"geo"
:
Tweet
.
geo
,
"source"
:
Tweet
.
source
,
"user_rt_id"
:
Tweet
.
user_rt_id
}
if
Tweet
.
retweet
:
_data
.
update
({
"user_rt_id"
:
Tweet
.
user_rt_id
})
try
:
_data
.
update
({
"near"
:
Tweet
.
near
})
except
AttributeError
:
pass
try
:
_data
.
update
({
"geo"
:
Tweet
.
geo
})
except
AttributeError
:
pass
_object_blocks
[
_type
]
.
append
(
_data
)
elif
_type
==
"user"
:
user
=
object
...
...
twint/storage/write_meta.py
View file @
a866e745
...
...
@@ -22,18 +22,12 @@ def tweetData(t):
"link"
:
t
.
link
,
"retweet"
:
t
.
retweet
,
"quote_url"
:
t
.
quote_url
,
"video"
:
t
.
video
"video"
:
t
.
video
,
"user_rt_id"
:
t
.
user_rt_id
,
"near"
:
t
.
near
,
"geo"
:
t
.
geo
,
"source"
:
t
.
source
}
if
t
.
retweet
:
data
.
update
({
"user_rt_id"
:
t
.
user_rt_id
})
try
:
data
.
update
({
"near"
:
t
.
near
})
except
AttributeError
:
pass
try
:
data
.
update
({
"geo"
:
t
.
geo
})
except
AttributeError
:
pass
return
data
def
tweetFieldnames
():
...
...
@@ -63,7 +57,8 @@ def tweetFieldnames():
"video"
,
"user_rt_id"
,
"near"
,
"geo"
"geo"
,
"source"
]
return
fieldnames
...
...
twint/tweet.py
View file @
a866e745
...
...
@@ -100,4 +100,5 @@ def Tweet(tw, config):
t
.
quote_url
=
getQuoteURL
(
tw
)
t
.
near
=
config
.
Near
if
config
.
Near
else
""
t
.
geo
=
config
.
Geo
if
config
.
Geo
else
""
t
.
source
=
config
.
Source
if
config
.
Source
else
""
return
t
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