diff options
Diffstat (limited to 'karpet/core.py')
| -rw-r--r-- | karpet/core.py | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/karpet/core.py b/karpet/core.py index 256942d..afae107 100644 --- a/karpet/core.py +++ b/karpet/core.py @@ -1,6 +1,5 @@ try: from pytrends.request import TrendReq - from twitterscraper import query_tweets except: pass @@ -273,83 +272,6 @@ class Karpet: return df.sort_values("date").reset_index(drop=True) - # def fetch_tweets(self, kw_list, lang, limit=None): - # """ - # Scrapes Twitter without any limits and returns dataframe with the - # following structure - - # * fullname - # * id - # * likes - # * replies - # * retweets - # * text - # * timestamp - # * url - # * user - # * date - # * has_link - - # :param list kw_list: List of keywords to search for. Will be joined with "OR" operator. - # :param str lang: Language of tweets to search in. - # :param int limit: Limit search results. Might get really big and slow so this should help. - # :return: Pandas dataframe with all search results (tweets). - # :rtype: pd.DataFrame - # """ - - # def process_tweets(tweets): - # """ - # Cleans up tweets and returns dataframe with the - # following structure - - # * fullname - # * id - # * likes - # * replies - # * retweets - # * text - # * timestamp - # * url - # * user - # * date - # * has_link - - # :param list tweets: List of dicts of tweets data. - # :return: Returns dataframe with all the scraped tweets (no index). - # :rtype: pd.DataFrame - # """ - - # # 1. Clean up. - # data = [] - - # for t in tweets: - # d = t.__dict__ - # del d["html"] - # data.append(d) - - # # 2. Create dataframe - # df = pd.DataFrame(data) - # # import pdb - - # # pdb.set_trace() - # df["date"] = df["timestamp"].dt.date - # df["has_link"] = df["text"].apply( - # lambda text: "http://" in text or "https://" in text - # ) - - # return df - - # try: - # _ = query_tweets - # except NameError: - # raise Exception("Twitter extension is not installed - see README file.") - - # tweets = query_tweets( - # query=" OR ".join(kw_list), begindate=self.start, lang=lang, limit=limit - # ) - - # return process_tweets(tweets) - def fetch_news(self, symbol, limit=10): """ Fetches news of the given symbol. Each news contains |