Commit 75ec4dce authored by sashika sewwandi's avatar sashika sewwandi

Upload New File

parent 38a5cf9e
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()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment