Search code examples
twittertweepytwitter4jtwitter-streaming-api

Does twitter stream API allow filtering by urls?


I am trying to do a filter by urls but no result is being returned. From the following doc, it shows it is possible https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/premium-operators but I think it's a premium feature. Is this true? If yes then is there any other way to filter by urls without using the premium feature?


Solution

  • Standard Twitter streaming API provide us with 'track' parameter. This is a Standard streaming API parameter (see the doc). It matches Tweets as by phrases as by URLs. A common use case according to the doc:

    a common use case where you may want to track all mentions of a particular domain name (i.e., regardless of subdomain or path), you should use “example com” as the track parameter for “example.com”

    This parameter value Will match...:

    example.comwww.example.com foo.example.com foo.example.com/bar I hope my startup isn’t merely another example of a dot com boom!

    I tested the option by means of twitter-hbc library for Java. It works as expected!

    To avoid confusion, please, take the note:

    The text of the Tweet and some entity fields are considered for matches. Specifically, the text attribute of the Tweet, expanded_url and display_url for links and media, text for hashtags, and screen_name for user mentions are checked for matches.