Hello.

I am writing with regards to a fixed effect in the usage of the “$” character. Please consider the following two queries.

Query1

import pandas as pd, numpy as np; from searchtweets import ResultStream, gen_rule_payload, load_credentials, collect_results,searchtweets 
print 'Version: ', (searchtweets.__version__)
premium_search_args = load_credentials("~/.twitter_keys.yaml",account_type="premium")
rule = gen_rule_payload("AVAV", results_per_call=10);print 'Rule: ', rule
tweets = collect_results(rule,max_results=10,result_stream_args=premium_search_args)
print [tweets[0][key] for key in tweets[0].keys()]

Query2

import pandas as pd, numpy as np; from searchtweets import ResultStream, gen_rule_payload, load_credentials, collect_results,searchtweets 
print 'Version: ', (searchtweets.__version__)
premium_search_args = load_credentials("~/.twitter_keys.yaml",account_type="premium")
rule = gen_rule_payload("$AVAV", results_per_call=10);print 'Rule: ', rule
tweets = collect_results(rule,max_results=10,result_stream_args=premium_search_args)
print [tweets[0][key] for key in tweets[0].keys()]

Output 1

['Sat May 12 22:10:41 +0000 2018',
 995426060589240326,
 '995426060589240326',
 'Hvis Island ikke kan lide vikingesangen, så er den helt gal! #higherground #lowerpoints #avav #escdk',
 '<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>',
 False,
 None,
 None,
 None,
 None,
 None,
 {'id': 711495675,
  'id_str': '711495675',
  'name': 'Marita á Rógvi',
  'screen_name': '_marogvi',
  'location': 'København, Danmark',
  'url': None,
  'description': 'Stolt og stædig færing! Freelancejournalist for danske og færøske medier 🇫🇴🇩🇰',
  'translator_type': 'none',
  'protected': False,
  'verified': False,
  'followers_count': 371,
  'friends_count': 659,
  'listed_count': 14,
  'favourites_count': 735,
  'statuses_count': 615,
  'created_at': 'Sat Oct 12 20:51:07 +0000 2013',
  'utc_offset': None,
  'time_zone': None,
  'geo_enabled': True,
  'lang': 'da',
  'contributors_enabled': False,
  'is_translator': False,
  'profile_background_color': 'C0DEED',
  'profile_background_image_url': 'http://pbs.twimg.com/profile_background_images/443057160662945792/BL8zZMqr.jpeg',
  'profile_background_image_url_https': 'https://pbs.twimg.com/profile_background_images/443057160662945792/BL8zZMqr.jpeg',
  'profile_background_tile': True,
  'profile_link_color': '0084B4',
  'profile_sidebar_border_color': '000000',
  'profile_sidebar_fill_color': 'DDEEF6',
  'profile_text_color': '333333',
  'profile_use_background_image': True,
  'profile_image_url': 'http://pbs.twimg.com/profile_images/928303665970139137/-IJaa_Ed_normal.jpg',
  'profile_image_url_https': 'https://pbs.twimg.com/profile_images/928303665970139137/-IJaa_Ed_normal.jpg',
  'profile_banner_url': 'https://pbs.twimg.com/profile_banners/711495675/1426538440',
  'default_profile': False,
  'default_profile_image': False,
  'following': None,
  'follow_request_sent': None,
  'notifications': None},
 None,
 None,
 None,
 None,
 False,
 0,
 0,
 0,
 4,
 {'hashtags': [{'text': 'higherground', 'indices': [61, 74]},
   {'text': 'lowerpoints', 'indices': [75, 87]},
   {'text': 'avav', 'indices': [88, 93]},
   {'text': 'escdk', 'indices': [94, 100]}],
  'urls': [],
  'user_mentions': [],
  'symbols': []},
 False,
 False,
 'low',
 'da',
 [{'tag': None}]]

Output 2

retrying request; current status code: 422
retrying request; current status code: 422
retrying request; current status code: 422
HTTP Error code: 422: There were errors processing your request: Reference to invalid operator 'cashtag'. Operator is not available in current product or product packaging. Must be from the list: [bounding_box, from, lang, place, place_country, point_radius, retweets_of, to, url, has:images, has:links, has:media, has:mentions, has:videos] (at position 1)
Rule payload: {'query': '$AVAV', 'maxResults': 10}

Output 1 is fine, but output 2 is not.

The difference between the two queries is simply the inclusion of “$” keyword argument. I believe my .yaml file and all else should be fine. Is there any special treatment I should be giving the “$”? I am aware I can do the query without the “$”, and subset with string splits. This, however, would increase the time and space complexity.

Thank you.

As a brief remark, I found online that one can use a --data-urlencode option ahead of an argument containing any special characters for curl POST data. However, I am not sure how this is implemented in searchtweets/python version.

Source

I think that the $ isn’t going to work because as the error text says it used to be a twitter product/uniquely trackable. Have you tried escaping it?

1 Like

Hi @zarzarbot -
The $ is actually an operator similar to # for Search API. The $ operator is only available for the higher tiers of premium than you are subscribed to according to your error:

Reference to invalid operator ‘cashtag’. Operator is not available in current product or product packaging.

@bobber205 - escaping or using “phrase search” in this case would actually give you the same result as the keyword search AVAV because the “phrase search” removes any punctuation before running the tokenized phrase match.

1 Like

@happycamper
Thanks for the clarification. Can you please specify which tier of premium I would need to subscribe to for the “$” operator? And are there any other instances such as this I should be aware of?

From this source I found that the “$” link is broken. According to this, however, it is only available with enterprise. As a premium user, am I not allowed to use it?

I am fairly sure cashtags are no longer something Twitter supports. The answer for the time being is probably never.

Have you tried just doing a “string” search like “$MSFT” or something like that

@bobber205
Thanks for the reply. I have been searching "$MSFT" as the pt_rule following the documents. The issue remains.

1 Like

@zarzarbot and @bobber205 apologies for the oversight, the $ operator is only available with the enterprise search:
https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/operators-by-product