can we use wild spelling in the query of Tiwtter search api ? - url

This page describes how to construct the query for twitter search. https://dev.twitter.com/rest/public/search
But it does not mention how to deal with the wildcard.
For example, if I want to search all keywords like this: smok*
smok* can represent Smoke, smoke, SMOKING, smoking, smoker etc. .
could I just simply say: q=smok* ?
I tried this, but it doesn't work. Could anyone help me ?

According to the search API documentation, there is no wildcard search available. Sorry.

Related

Twitter Search for All Words Ending with... (Corpus Linguistics)

I am using Twitter to a create a corpus and I need to search for Tweets containing specific grammatical constructions with, e.g., verbs ending in -ing.
For example: I would like to search for Tweets containing the construction:
I enjoy + any verb ending in -ing
Results should include all Tweets with any instance of I enjoy + verb ending in -ing, such as "I enjoy swimming," "I enjoy listening to music," etc.
I understand the Twitter API does not support regular expressions, so any ideas are welcome.
Thanks!
There are two things you can try.
The first is creating a list of verbs you want to search for, and then searching for an exact phrase and a list of potential verbs:
"I enjoy" doing OR eating OR seeing
https://twitter.com/search?l=&q=%22I%20enjoy%22%20doing%20OR%20eating%20OR%20seeing&src=typd
The second is to just search for "I enjoy" and then filtering the results client side. I'd suggest using the streaming API for this if you want to get the most results.
Good luck!

Twitter Advanced Search not showing results

I am trying to do a simple twitter adv search query where I want to find tweets tweeted by "#BSE_News" and that contain some word like for example "Financial". However, twitter's search doesn't show any tweet and there are tons of tweets that are tweeted by BSE_News that contain this word.
What I am doing currently -
Go to the advanced search section once I have logged into my twitter a/c
I enter "Financial" in the "This exact phrase" text box and "#BSE_News" in the "From these accounts" text box. Not sure what I am doing wrong here. Any help would be appreciated.
Thank you.
You can use Twitter's advanced search boolean operators, coupled with the advanced search operator from: to construct the following query (you can copy & paste it into Twitter's search box or type it directly there):
(financial) from:BSE_News 👀
Of course, you can also broaden or narrow your search by playing with the boolean statement in between the parenthesis using the OR, AND, -(minus for NOT) and ( ) boolean combinations. For example:
(financial OR economic OR monetary OR fiscal) from:BSE_News 👀
(financial AND 2019) from:BSE_News 👀
((financial AND PODDAR) -quarter) from:BSE_News 👀
I guess with the advanced search...some functionalities were disabled, like you don't have the sentiments section anymore

Dailymotion Graph API Search string

I am unable to get Dailymotion Graph API to do a search on a multiple word term. For example:
https://api.dailymotion.com/videos/?search=%22glacier+national+park%22&page=1&limit=3
Will still search on each word separately.
If I &sort=relevance, then it is fine, but if I'd like to sort differently, it will pull titles with only the word "national" in them, and not restrict to the full term.
Their own Graph API tool mimics this:
https://www.dailymotion.com/doc/api/explorer#/video/list
It almost seems like it is a bug, but prolly I'm just not finding the right syntax.
TIA!
Good news, you can do a search on multiple terms by using quotes around words.
Hence your request:
https://api.dailymotion.com/videos/?search=%22glacier+national+park%22&page=1&limit=3
should return what you're looking for!

How to retrieve top 10 Google search results from a keyword through an API in Ruby?

I'm a little confused as to what is the best way to retrieve the top 10 Google results for a specific search/keyword. I just need the title and url (description is not essential).
I'm using Ruby and apparently there was a great way to do it with the googleajax gem. I've been able to get it to work but am concerned that it's a deprecated API and could be phased out any day. Also, the workaround to get more than 4 results at a time isn't very clean.
I think the Google Custom Search might be an option but the daily limit of 100 queries is restricting. I would prefer to not scrape Google as it's a violation of their terms.
What other options do I have to make this work? Any json/ruby/rails option would work for me. Thank you!
We ended having the same issue, and we built our own gem with our own backend. It's pretty simple to use:
query = GoogleSearchResults.new q: "coffee"
hash_results = query.get_hash
https://github.com/serpapi/google-search-results-ruby
You're not very explicit in your question about the trade offs you're willing to make, But you might want to think about this more:
I think the Google Custom Search might be an option but the daily limit of 100 queries is restricting. I would prefer to not scrape Google as it's a violation of their terms.
I've used google custom search, and it is very easy but the limit is in place. If you are concerned about not violating Google's TOS, this is the only way to go. You need to decide if you're willing to violate the TOS, and if not you should just use the google custom search.
I recommend use 'rest-client' gem.
RestClient.get 'google_api_url'
it occurred to me first, just example:
require 'open-uri'
require 'nokogiri'
require 'restclient'
words = ["Foo", "Bar", "Baz"]
staff = [].tap do |acc|
words.each do |word|
link = "https://www.google.com/search?q=#{word}"
page = Nokogiri::HTML(RestClient.get(link))
page.css('a')[27].text
.....................# <- and parse data what you need
end
end
If your requirement is more than 100 queries on a single day, but not on a daily/regular basis and if Google results are not a must have, you can consider using Bing Search API.
The Bing Search API allows for 5000 queries a month, all of which you can choose to use on a single day itself. Again, this will solve your problem if your requirement is not a daily/regular one and you can look beyond Google.
Else, paying Google is your only way out.

Twitter Search Api to find exact results

I am using twitter search api
https://dev.twitter.com/docs/using-search
I want to search for a word (exact match) and count the no of mentions or hashtags of that word (exact match).
I have tried q="json" OR #json OR #json but they retun something like json_decode or #json_dude but I want exact match.
Also, is there anyway to count the no of retweets without 'popular' search ?
In the page you linked, see the paragraph of "Search Operators", the 2nd example is what you are looking for. It says you sould use "
just like in a google search.
You cannot do exact search like this, there's no way.
You can do exact search only when you are not using `OR'
i.e. you can do q="json" but not q="json" OR #json OR #json.
But you can count the retweets by looking at field in_reply_to_status_id_str. Each in_reply_to_status_id_str represents that its a reply against a tweet , thus a retweet :)

Resources