Here’s a nice trick if you want to create a Twitter Search URL that directly accesses the Twitter search function. With a Twitter search URL, you can create links for your readers to view all the tweets associated with Twitter handle feeds, a hashtag, or a combination of both a Twitter handle or a hashtag.
Here’s how to create a URL that directly accesses the Twitter search function and returns all tweets associated with specific Twitter handles or hashtags.
1. Start with this beginning Twitter URL:
The %28 character is the hexadecimal representation of the left parenthesis character ‘(‘.
2. If you want to retrieve all the top tweets for a specific twitter handle, add the Twitter handle name to the URL in point 1, omitting the ‘@’ character in the handle. So if I wanted to create a URL that displays all the top tweets associated with my Twitter handle (@joehertvik), I’d add the name joehertvik to the end of the URL I started in item 1, like this.
https://twitter.com/search/?q=%28joehertvik (click to test)
Any reader who clicks on the URL will invoke the Twitter Search function to view the top tweets that reference my Twitter handle (this is the default behavior for these URLs). Substitute any Twitter name for joehertvik in this URL and you’ll be able to go to Twitter and display all that person’s top tweets that mention that twitter handle.
If I want to view ALL the tweets that reference my Twitter handle not just the top tweets, I would modify this URL to add the &f=realtime parameter, like this:
https://twitter.com/search/?q=%28joehertvik&f=realtime (click to test)
And this will show all my tweets in reverse chronological order.
3. If you want to retrieve all the top tweets for a specific Twitter hashtag, start again with the beginning Twitter URL listed in point 1 and add a hexadecimal character %23 to that URL. %23 is the hex representation of the hash character (#). After the %23 hash character, complete the hashtag by adding the text part of the hashtag you want to search on.
So if I wanted see all the top tweets for the #powersystems hashtag for example, I would modify the beginning URL in point 1 to looks like this:
https://twitter.com/search/?q=%28%23powersystems (Click to test)
And Twitter would return all the top tweets associated with that hashtag. Put in whatever hashtag name you’d like to view other hashtags.
Again, to search ALL the tweets for this hashtag in reverse chronological order (not just the top tweets), I would modify that URL with the &f=realtime parameter, like this:
https://twitter.com/search/?q=%28%23powersystems&f=realtime (click to test)
And that would give me all the #powersystems tweets.
4. To set up URLs to view Twitter search for multiple Twitter handles, add the following string to the basic URL in point 1.
The %20 character is the hexadecimal representation of a blank space, which means I’m functionally adding the term ‘ handle1 OR handle2‘ to the URL.
So if I wanted to view all the tweets for Twitter handles @joehertvik (handle1) and @chicagoproblems (handle2), I would use this URL:
And this will start the Twitter search and return any tweets where joehertvik or chicagoproblems are mentioned.
5. If I wanted to return all the tweets for two hashtags, I would add the following string to the basic URL listed in point 1.
Again, the %23 character is the hexadecimal representation of the ‘#’ character while the %20OR%20 string represents the string ‘ OR ‘.
So if I wanted to return the tweets that use the hashtags #powersystems and #ibmi, I would code URL this way:
And this will start the Twitter function returning all the tweets that use the hashtags #powersystems or #ibmi.
6. Finally, if I wanted to return all the tweets associated with either a Twitter handle or a hashtag, I would add this string to the URL listed in point 1.
So if I wanted to find all the tweets for Twitter handle @joehertvik or hashtag #ibmi, I would use the following tweet (again drop the ‘@’ from the Twitter handle).
These are the basic URL formats for creating a Twitter search URL. Once you get these formats, it’s easy to expand them to create URLs that automatically search Twitter for any combination of Twitter handles and hashtags.
There are also a few more tricks for creating Twitter URLs. But this post is already too long, so I’ll save those items for a later tip.