Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Anomaly Detection in Microservices Systems
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
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
sashika sewwandi
Anomaly Detection in Microservices Systems
Commits
75ec4dce
Commit
75ec4dce
authored
Oct 10, 2022
by
sashika sewwandi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
38a5cf9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
Twitter.py
Twitter.py
+41
-0
No files found.
Twitter.py
0 → 100644
View file @
75ec4dce
from
__future__
import
print_function
import
twint
import
sys
from
Template
import
Baseclass
class
Twitter
(
Baseclass
):
def
__init__
(
self
):
self
.
page_link
=
None
self
.
zip_file_path
=
None
self
.
download_url
=
None
self
.
file
=
None
def
create_download_url
(
self
):
try
:
c
=
twint
.
Config
()
c
.
Search
=
[
self
.
key_word
]
# topic
c
.
Limit
=
self
.
data_size
# number of Tweets to scrape
c
.
Store_csv
=
True
# store tweets in a csv file
c
.
Output
=
self
.
output_file
# path to csv file
twint
.
run
.
Search
(
c
)
except
Exception
as
e
:
print
(
"Can't scrape data from this site:"
,
self
.
page_link
)
print
(
e
)
sys
.
exit
(
-
1
)
else
:
print
(
"data extraction process is success"
)
def
invoke
(
self
):
self
.
metadata_setup
(
"twitter_config"
)
self
.
create_download_url
()
self
.
s3_data_transfer
(
self
.
output_file
)
if
__name__
==
'__main__'
:
custom_driver_params
=
'Create a new file WebScraping Twitter data'
new_file
=
Twitter
()
new_file
.
invoke
()
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