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
448658da
Commit
448658da
authored
May 14, 2019
by
Snipe
Committed by
Francesco Poldi
May 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cashtag functionality (#421)
* Cashtag functionality * Update write_meta.py
parent
071b9708
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
19 additions
and
1 deletion
+19
-1
elasticsearch/index-tweets.json
elasticsearch/index-tweets.json
+1
-0
twint/__version__.py
twint/__version__.py
+1
-1
twint/cli.py
twint/cli.py
+2
-0
twint/config.py
twint/config.py
+1
-0
twint/format.py
twint/format.py
+4
-0
twint/output.py
twint/output.py
+2
-0
twint/storage/db.py
twint/storage/db.py
+2
-0
twint/storage/elasticsearch.py
twint/storage/elasticsearch.py
+2
-0
twint/storage/panda.py
twint/storage/panda.py
+1
-0
twint/storage/write_meta.py
twint/storage/write_meta.py
+2
-0
twint/tweet.py
twint/tweet.py
+1
-0
No files found.
elasticsearch/index-tweets.json
View file @
448658da
...
...
@@ -12,6 +12,7 @@ PUT twinttweets
"location"
:
{
"type"
:
"keyword"
},
"tweet"
:
{
"type"
:
"text"
},
"hashtags"
:
{
"type"
:
"keyword"
},
"cashtags"
:
{
"type"
:
"keyword"
},
"user_id"
:
{
"type"
:
"long"
},
"user_id_str"
:
{
"type"
:
"keyword"
},
"username"
:
{
"type"
:
"keyword"
},
...
...
twint/__version__.py
View file @
448658da
VERSION
=
(
1
,
2
,
1
)
VERSION
=
(
1
,
2
,
2
)
__version__
=
'.'
.
join
(
map
(
str
,
VERSION
))
\ No newline at end of file
twint/cli.py
View file @
448658da
...
...
@@ -78,6 +78,7 @@ def initialize(args):
c
.
Store_csv
=
args
.
csv
c
.
Store_json
=
args
.
json
c
.
Show_hashtags
=
args
.
hashtags
c
.
Show_cashtags
=
args
.
cashtags
c
.
Limit
=
args
.
limit
c
.
Count
=
args
.
count
c
.
Stats
=
args
.
stats
...
...
@@ -136,6 +137,7 @@ def options():
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
(
"--hashtags"
,
help
=
"Output hashtags in seperate column."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--cashtags"
,
help
=
"Output cashtags in seperate column."
,
action
=
"store_true"
)
ap
.
add_argument
(
"--userid"
,
help
=
"Twitter user id."
)
ap
.
add_argument
(
"--limit"
,
help
=
"Number of Tweets to pull (Increments of 20)."
)
ap
.
add_argument
(
"--count"
,
help
=
"Display number of Tweets scraped at the end of session."
,
...
...
twint/config.py
View file @
448658da
...
...
@@ -19,6 +19,7 @@ class Config:
Store_json
=
False
Custom
=
{
"tweet"
:
None
,
"user"
:
None
,
"username"
:
None
}
Show_hashtags
=
False
Show_cashtags
=
False
Limit
=
None
Count
=
None
Stats
=
False
...
...
twint/format.py
View file @
448658da
...
...
@@ -12,6 +12,7 @@ def Tweet(config, t):
output
=
output
.
replace
(
"{tweet}"
,
t
.
tweet
)
output
=
output
.
replace
(
"{location}"
,
t
.
location
)
output
=
output
.
replace
(
"{hashtags}"
,
str
(
t
.
hashtags
))
output
=
output
.
replace
(
"{cashtags}"
,
str
(
t
.
cashtags
))
output
=
output
.
replace
(
"{replies}"
,
t
.
replies_count
)
output
=
output
.
replace
(
"{retweets}"
,
t
.
retweets_count
)
output
=
output
.
replace
(
"{likes}"
,
t
.
likes_count
)
...
...
@@ -30,6 +31,9 @@ def Tweet(config, t):
if
config
.
Show_hashtags
:
hashtags
=
","
.
join
(
t
.
hashtags
)
output
+=
f
" {hashtags}"
if
config
.
Show_cashtags
:
cashtags
=
","
.
join
(
t
.
cashtags
)
output
+=
f
" {cashtags}"
if
config
.
Stats
:
output
+=
f
" | {t.replies_count} replies {t.retweets_count} retweets {t.likes_count} likes"
if
config
.
Location
:
...
...
twint/output.py
View file @
448658da
...
...
@@ -58,6 +58,8 @@ def _output(obj, output, config, **extra):
obj
.
mentions
[
i
]
=
obj
.
mentions
[
i
]
.
lower
()
for
i
in
range
(
len
(
obj
.
hashtags
)):
obj
.
hashtags
[
i
]
=
obj
.
hashtags
[
i
]
.
lower
()
for
i
in
range
(
len
(
obj
.
cashtags
)):
obj
.
cashtags
[
i
]
=
obj
.
cashtags
[
i
]
.
lower
()
else
:
logme
.
info
(
'_output:Lowercase:hiddenTweetFound'
)
print
(
"[x] Hidden tweet found, account suspended due to violation of TOS"
)
...
...
twint/storage/db.py
View file @
448658da
...
...
@@ -72,6 +72,7 @@ def init(db):
link text,
mentions text,
hashtags text,
cashtags text,
urls text,
photos text,
quote_url text,
...
...
@@ -240,6 +241,7 @@ def tweets(conn, Tweet, config):
Tweet
.
link
,
","
.
join
(
Tweet
.
mentions
),
","
.
join
(
Tweet
.
hashtags
),
","
.
join
(
Tweet
.
cashtags
),
","
.
join
(
Tweet
.
urls
),
","
.
join
(
Tweet
.
photos
),
Tweet
.
quote_url
,
...
...
twint/storage/elasticsearch.py
View file @
448658da
...
...
@@ -65,6 +65,7 @@ def createIndex(config, instance, **scope):
"location"
:
{
"type"
:
"keyword"
},
"tweet"
:
{
"type"
:
"text"
},
"hashtags"
:
{
"type"
:
"keyword"
},
"cashtags"
:
{
"type"
:
"keyword"
},
"user_id"
:
{
"type"
:
"long"
},
"user_id_str"
:
{
"type"
:
"keyword"
},
"username"
:
{
"type"
:
"keyword"
},
...
...
@@ -199,6 +200,7 @@ def Tweet(Tweet, config):
"location"
:
Tweet
.
location
,
"tweet"
:
Tweet
.
tweet
,
"hashtags"
:
Tweet
.
hashtags
,
"cashtags"
:
Tweet
.
cashtags
,
"user_id"
:
Tweet
.
user_id
,
"user_id_str"
:
Tweet
.
user_id_str
,
"username"
:
Tweet
.
username
,
...
...
twint/storage/panda.py
View file @
448658da
...
...
@@ -70,6 +70,7 @@ def update(object, config):
"location"
:
Tweet
.
location
,
"tweet"
:
Tweet
.
tweet
,
"hashtags"
:
Tweet
.
hashtags
,
"cashtags"
:
Tweet
.
cashtags
,
"user_id"
:
Tweet
.
user_id
,
"user_id_str"
:
Tweet
.
user_id_str
,
"username"
:
Tweet
.
username
,
...
...
twint/storage/write_meta.py
View file @
448658da
...
...
@@ -19,6 +19,7 @@ def tweetData(t):
"likes_count"
:
int
(
t
.
likes_count
),
"location"
:
t
.
location
,
"hashtags"
:
t
.
hashtags
,
"cashtags"
:
t
.
cashtags
,
"link"
:
t
.
link
,
"retweet"
:
t
.
retweet
,
"quote_url"
:
t
.
quote_url
,
...
...
@@ -48,6 +49,7 @@ def tweetFieldnames():
"likes_count"
,
"location"
,
"hashtags"
,
"cashtags"
,
"link"
,
"retweet"
,
"quote_url"
,
...
...
twint/tweet.py
View file @
448658da
...
...
@@ -88,6 +88,7 @@ def Tweet(tw, location, config):
t
.
tweet
=
getText
(
tw
)
t
.
location
=
location
t
.
hashtags
=
[
hashtag
.
text
for
hashtag
in
tw
.
find_all
(
"a"
,
"twitter-hashtag"
)]
t
.
cashtags
=
[
cashtag
.
text
for
cashtag
in
tw
.
find_all
(
"a"
,
"twitter-cashtag"
)]
t
.
replies_count
=
getStat
(
tw
,
"reply"
)
t
.
retweets_count
=
getStat
(
tw
,
"retweet"
)
t
.
likes_count
=
getStat
(
tw
,
"favorite"
)
...
...
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