Skip to content

Commit

Permalink
Fixing query length test in twitter api scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Jul 5, 2021
1 parent 0150995 commit 9f3a95b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion minet/twitter/api_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
# =============================================================================
# Helpers
# =============================================================================
def is_query_too_long(query):
return len(quote(query)) > MAXIMUM_QUERY_LENGTH


def forge_search_url(query):
return (
'https://twitter.com/search?f=live&type=spelling_expansion_revert_click&q=%s' %
Expand Down Expand Up @@ -316,7 +320,7 @@ def request_search(self, query, cursor=None, refs=None, dump=False):
def search(self, query, limit=None, before_sleep=None,
include_referenced_tweets=False, with_meta=False):

if len(query) > MAXIMUM_QUERY_LENGTH:
if is_query_too_long(query):
raise TwitterPublicAPIQueryTooLongError

cursor = None
Expand Down

0 comments on commit 9f3a95b

Please sign in to comment.