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
a72347f4
Commit
a72347f4
authored
Jun 16, 2018
by
Francesco Poldi
Committed by
GitHub
Jun 16, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into master
parents
b2178509
b74d7e46
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
26 deletions
+35
-26
.github/ISSUE_TEMPLATE.md
.github/ISSUE_TEMPLATE.md
+0
-0
Twint.py
Twint.py
+3
-0
twint/__version__.py
twint/__version__.py
+1
-1
twint/config.py
twint/config.py
+4
-4
twint/db.py
twint/db.py
+4
-4
twint/dbmysql.py
twint/dbmysql.py
+1
-4
twint/elasticsearch.py
twint/elasticsearch.py
+22
-13
No files found.
ISSUE_TEMPLATE.md
→
.github/
ISSUE_TEMPLATE.md
View file @
a72347f4
File moved
Twint.py
View file @
a72347f4
...
...
@@ -195,6 +195,9 @@ def main():
if
not
args
.
index_users
:
args
.
index_users
=
"twintUser"
if
not
args
.
essid
:
args
.
essid
=
""
c
=
initialize
(
args
)
if
args
.
favorites
:
...
...
twint/__version__.py
View file @
a72347f4
VERSION
=
(
1
,
1
,
3
,
4
)
#mysql support
VERSION
=
(
1
,
1
,
3
,
5
)
#mysql support
__version__
=
'.'
.
join
(
map
(
str
,
VERSION
))
twint/config.py
View file @
a72347f4
...
...
@@ -29,7 +29,7 @@ class Config:
All
=
None
Debug
=
False
Format
=
None
Essid
=
None
Essid
=
""
Profile
=
False
Followers
=
False
Following
=
False
...
...
@@ -42,6 +42,6 @@ class Config:
Pandas_type
=
None
Pandas
=
False
Search_name
=
"-"
#for identify a records in mysql with the search it provides from. it cannot be null for DB requirements. a tweet must be in several search so the PK are tweet ID and search_name
Index_tweets
=
None
Index_follow
=
None
Index_users
=
None
Index_tweets
=
"twint"
Index_follow
=
"twintGraph"
Index_users
=
"twintUser"
\ No newline at end of file
twint/db.py
View file @
a72347f4
...
...
@@ -91,7 +91,7 @@ def init(db):
);
"""
cursor
.
execute
(
table_followers
)
table_following
=
"""
CREATE TABLE IF NOT EXISTS
following (
...
...
@@ -127,7 +127,7 @@ def fTable(Followers):
table
=
"followers_names"
else
:
table
=
"following_names"
return
table
def
uTable
(
Followers
):
...
...
@@ -135,7 +135,7 @@ def uTable(Followers):
table
=
"followers"
else
:
table
=
"following"
return
table
def
follow
(
conn
,
Username
,
Followers
,
User
):
...
...
@@ -168,7 +168,7 @@ def user(conn, Username, Followers, User):
User
.
media_count
,
User
.
is_private
,
User
.
is_verified
,
User
.
avatar
,
User
.
avatar
,
date_time
,
Username
,)
query
=
'INSERT INTO {} VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
.
format
(
uTable
(
Followers
))
...
...
twint/dbmysql.py
View file @
a72347f4
...
...
@@ -33,7 +33,6 @@ def fTable(Followers):
table
=
"followers_names"
else
:
table
=
"following_names"
return
table
def
uTable
(
Followers
):
...
...
@@ -41,7 +40,6 @@ def uTable(Followers):
table
=
"followers"
else
:
table
=
"following"
return
table
def
follow
(
conn
,
Username
,
Followers
,
User
):
...
...
@@ -80,10 +78,9 @@ def user(conn, Username, Followers, User):
query
=
'INSERT INTO {} VALUES(
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)'
.
format
(
uTable
(
Followers
))
cursor
.
execute
(
query
,
entry
)
conn
.
commit
()
except
MySQLdb
.
IntegrityError
:
pass
def
tweets
(
conn
,
Tweet
,
config
):
try
:
...
...
twint/elasticsearch.py
View file @
a72347f4
...
...
@@ -31,7 +31,16 @@ def hour(datetime):
return
strftime
(
"
%
H"
,
localtime
(
datetime
))
def
Tweet
(
Tweet
,
config
):
day
=
weekday
(
strftime
(
"
%
A"
,
localtime
(
Tweet
.
datetime
)))
weekdays
=
{
"Monday"
:
1
,
"Tuesday"
:
2
,
"Wednesday"
:
3
,
"Thursday"
:
4
,
"Friday"
:
5
,
"Saturday"
:
6
,
"Sunday"
:
7
,
}
day
=
weekdays
[
strftime
(
"
%
A"
,
localtime
(
Tweet
.
datetime
))]
actions
=
[]
nLikes
=
0
...
...
@@ -43,7 +52,7 @@ def Tweet(Tweet, config):
j_data
=
{
"_index"
:
config
.
Index_tweets
,
"_type"
:
"items"
,
"_id"
:
Tweet
.
id
+
"_raw_"
+
str
(
config
.
Essid
)
,
"_id"
:
Tweet
.
id
+
"_raw_"
+
config
.
Essid
,
"_source"
:
{
"id"
:
Tweet
.
id
,
"date"
:
dt
,
...
...
@@ -58,7 +67,7 @@ def Tweet(Tweet, config):
"link"
:
Tweet
.
link
,
"retweet"
:
Tweet
.
retweet
,
"user_rt"
:
Tweet
.
user_rt
,
"essid"
:
str
(
config
.
Essid
)
"essid"
:
config
.
Essid
}
}
actions
.
append
(
j_data
)
...
...
@@ -67,7 +76,7 @@ def Tweet(Tweet, config):
j_data
=
{
"_index"
:
config
.
Index_tweets
,
"_type"
:
"items"
,
"_id"
:
Tweet
.
id
+
"_likes_"
+
str
(
nLikes
)
+
"_"
+
str
(
config
.
Essid
)
,
"_id"
:
Tweet
.
id
+
"_likes_"
+
str
(
nLikes
)
+
"_"
+
config
.
Essid
,
"_source"
:
{
"id"
:
Tweet
.
id
,
"date"
:
dt
,
...
...
@@ -83,7 +92,7 @@ def Tweet(Tweet, config):
"link"
:
Tweet
.
link
,
"retweet"
:
Tweet
.
retweet
,
"user_rt"
:
Tweet
.
user_rt
,
"essid"
:
str
(
config
.
Essid
)
"essid"
:
config
.
Essid
}
}
actions
.
append
(
j_data
)
...
...
@@ -93,7 +102,7 @@ def Tweet(Tweet, config):
j_data
=
{
"_index"
:
config
.
Index_tweets
,
"_type"
:
"items"
,
"_id"
:
Tweet
.
id
+
"_replies_"
+
str
(
nReplies
)
+
"_"
+
str
(
config
.
Essid
)
,
"_id"
:
Tweet
.
id
+
"_replies_"
+
str
(
nReplies
)
+
"_"
+
config
.
Essid
,
"_source"
:
{
"id"
:
Tweet
.
id
,
"date"
:
dt
,
...
...
@@ -109,7 +118,7 @@ def Tweet(Tweet, config):
"link"
:
Tweet
.
link
,
"retweet"
:
Tweet
.
retweet
,
"user_rt"
:
Tweet
.
user_rt
,
"essid"
:
str
(
config
.
Essid
)
"essid"
:
config
.
Essid
}
}
actions
.
append
(
j_data
)
...
...
@@ -119,7 +128,7 @@ def Tweet(Tweet, config):
j_data
=
{
"_index"
:
config
.
Index_tweets
,
"_type"
:
"items"
,
"_id"
:
Tweet
.
id
+
"_retweets_"
+
str
(
nRetweets
)
+
"_"
+
str
(
config
.
Essid
)
,
"_id"
:
Tweet
.
id
+
"_retweets_"
+
str
(
nRetweets
)
+
"_"
+
config
.
Essid
,
"_source"
:
{
"id"
:
Tweet
.
id
,
"date"
:
dt
,
...
...
@@ -135,7 +144,7 @@ def Tweet(Tweet, config):
"link"
:
Tweet
.
link
,
"retweet"
:
Tweet
.
retweet
,
"user_rt"
:
Tweet
.
user_rt
,
"essid"
:
str
(
config
.
Essid
)
"essid"
:
config
.
Essid
}
}
actions
.
append
(
j_data
)
...
...
@@ -152,11 +161,11 @@ def Follow(user, config):
j_data
=
{
"_index"
:
config
.
Index_follow
,
"_type"
:
"items"
,
"_id"
:
user
+
"_"
+
config
.
Username
+
"_"
+
str
(
config
.
Essid
)
,
"_id"
:
user
+
"_"
+
config
.
Username
+
"_"
+
config
.
Essid
,
"_source"
:
{
"user"
:
user
,
"follow"
:
config
.
Username
,
"essid"
:
str
(
config
.
Essid
)
"essid"
:
config
.
Essid
}
}
actions
.
append
(
j_data
)
...
...
@@ -172,7 +181,7 @@ def UserProfile(user, config):
j_data
=
{
"_index"
:
config
.
Index_users
,
"_type"
:
"items"
,
"_id"
:
user
.
id
+
"_"
+
user
.
join_date
+
"_"
+
user
.
join_time
+
"_"
+
str
(
config
.
Essid
)
,
"_id"
:
user
.
id
+
"_"
+
user
.
join_date
+
"_"
+
user
.
join_time
+
"_"
+
config
.
Essid
,
"_source"
:
{
"id"
:
user
.
id
,
"name"
:
user
.
name
,
...
...
@@ -191,7 +200,7 @@ def UserProfile(user, config):
"private"
:
user
.
is_private
,
"verified"
:
user
.
is_verified
,
"avatar"
:
user
.
avatar
,
"session"
:
str
(
config
.
Essid
)
"session"
:
config
.
Essid
}
}
actions
.
append
(
j_data
)
...
...
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