Twitter

class orangecontrib.text.twitter.TwitterAPI(bearer_token)[source]

Fetch tweets from the Tweeter API.

Notes

Results across multiple searches are aggregated. To remove tweets form previous searches and only return results from the last search either call reset method before searching or provide collecting=False argument to search method.

__init__(bearer_token)[source]
reset()[source]

Removes all downloaded tweets.

search_authors(authors: ~typing.List[str], *, max_tweets: ~typing.Optional[int] = 45000, collecting: bool = False, callback: ~typing.Callable = <function dummy_callback>) Optional[Corpus][source]

Search recent tweets by authors.

Parameters
  • authors – A list of authors to search for.

  • max_tweets – Limits the number of downloaded tweets. If none use APIs maximum.

  • collecting – Whether to collect results across multiple search calls.

  • callback – Function to report the progress

Return type

Corpus with tweets

search_content(content: ~typing.List[str], *, max_tweets: ~typing.Optional[int] = 45000, lang: ~typing.Optional[str] = None, allow_retweets: bool = True, collecting: bool = False, callback: ~typing.Callable = <function dummy_callback>) Optional[Corpus][source]

Search recent tweets by content (keywords).

Parameters
  • content – A list of key-words to search for.

  • max_tweets – Limits the number of downloaded tweets. If none use APIs maximum.

  • lang – A language’s code (either ISO 639-1 or ISO 639-3 formats).

  • allow_retweets – Whether to download retweets.

  • collecting – Whether to collect results across multiple search calls.

  • callback – Function to report the progress

Return type

Corpus with tweets