Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CCC-Assignment2-Team69
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xinjie Lan
CCC-Assignment2-Team69
Commits
33c24050
Commit
33c24050
authored
May 12, 2019
by
Terry Liao
Browse files
Options
Downloads
Patches
Plain Diff
修正import语法
parent
73e560f4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tweet_havester/tweepy_search.py
+2
-2
2 additions, 2 deletions
tweet_havester/tweepy_search.py
tweet_havester/tweepy_stream.py
+1
-3
1 addition, 3 deletions
tweet_havester/tweepy_stream.py
with
3 additions
and
5 deletions
tweet_havester/tweepy_search.py
+
2
−
2
View file @
33c24050
...
...
@@ -5,7 +5,7 @@ import couchdb
import
tweepy
from
tweepy
import
OAuthHandler
from
sklearn.externals
import
joblib
import
general_process
as
gp
class
TweetSearchHavester
():
...
...
@@ -43,7 +43,6 @@ class TweetSearchHavester():
process_db
=
self
.
couch
[
'
tweet_results
'
]
for
tweet
in
tweepy
.
Cursor
(
api
.
user_timeline
,
id
=
user_id
).
items
(
50
):
# save most recent tweets
gp
=
GP
()
dic
=
{}
dic
[
'
_id
'
]
=
tweet
.
id_str
dic
[
'
create_time
'
]
=
str
(
tweet
.
created_at
)
...
...
@@ -57,6 +56,7 @@ class TweetSearchHavester():
# print(dic)
try
:
p_dic
=
gp
.
data_process
(
dic
,
self
.
model
)
print
(
p_dic
)
if
p_dic
!=
None
:
process_db
.
save
(
p_dic
)
db
.
save
(
dic
)
...
...
This diff is collapsed.
Click to expand it.
tweet_havester/tweepy_stream.py
+
1
−
3
View file @
33c24050
...
...
@@ -8,7 +8,7 @@ from tweepy import OAuthHandler
from
tweepy
import
Stream
from
tweepy.streaming
import
StreamListener
from
sklearn.externals
import
joblib
import
general_process
as
GP
import
general_process
as
gp
class
listener
(
StreamListener
):
def
__init__
(
self
,
path
):
...
...
@@ -28,7 +28,6 @@ class listener(StreamListener):
return
dic
def
on_data
(
self
,
data
):
try
:
gp
=
GP
()
db
=
self
.
couch
[
'
raw_tweets
'
]
id_db
=
self
.
couch
[
'
user_id
'
]
pc_db
=
self
.
couch
[
'
tweet_results
'
]
...
...
@@ -38,7 +37,6 @@ class listener(StreamListener):
# print(id_doc)
p_dic
=
gp
.
data_process
(
dic
,
self
.
model
)
if
p_dic
!=
None
:
process_db
.
save
(
p_dic
)
id_db
.
save
(
id_doc
)
db
.
save
(
dic
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment