Google Custom search engine vs Normal google search - google-custom-search

I want to integrate google search in one my python application. I did using google CSE. But I am not getting result as what i am typing exactly in google search. I am providing few examples
Query : "who is US president"
CSE Result : "List of us presidents" from wiki
Google search : "Donald Trump"
Query : "japan president"
CSE Result : " Prime minister of Japan" from wiki
Google serach : "Shinzō Abe
Why this difference ? Google direct search is giving actual result while Google custom search engine not. This result will be in second or third in result array, not the first one.
How can i get the exact result in custom search engine ?I try adding few url patterns and search whole web . But dint got exact values for these. The direct google search url will be like " https://www.google.co.in/#q=japan+president " . How can i configure google custom search to get the same result that of google search engine ?

Related

[Mendeley API]: How to search for partial terms

I am using the Mendeley API to retrieve documents in the profile of a user.
Specifically, I am using this API:
GET https://api.mendeley.com/search/documents?view=all&limit=25&title=ONTOLOGY
I would like to search for all the documents that match a partial term, i.e. instead of the full word "ONTOLOGY" I would like to get the same result if I do an HTTP call like
GET https://api.mendeley.com/search/documents?view=all&limit=25&title=ONTOLO
How can I achieve that?
Should I put any jolly character?
I tried
ONTOLO*
ONTOLO$
ONTOLO?
with no luck.
I haven't found any documentation related to this feature.
Thanks!!

Search special items (movies) in google api

hi i have a project and need to search movies name in any language .
in google i can find them but i need some api for project .like JSON api of list of movies and tv show with original name and rate or something
like this result search but in json:
https://www.google.com/search?q=%D9%85%D8%B1%D8%AF+%D8%A2%D9%87%D9%86%DB%8C+2010
i found this:
https://developers.google.com/custom-search/v1/introduction
and this filters
https://developers.google.com/custom-search/v1/reference/rest/v1/cse/list
but it's show website results not special item !
and i found imdb api:
https://sg.media-imdb.com/suggests/i/ironman.json
that was working fine but only search with english name
so any help?!!

Google Sheets IMPORTXML: Xpath not working (document node does provide data)

Using Google Sheets, I am trying to retrieve text passages from the Perseus Scaife Library, which has a working API.
When I query for the document node (=importxml("https://scaife-cts.perseus.org/api/cts?request=GetPassage&urn=urn:cts:greekLit:tlg0527.tlg001.opp-grc2:1.1","/")) I get all the data, including the URNs etc. However, any other xpath_query gives an error.
I know that Google Sheets can access the data, but I would like to be able to select only one node (//p).
You want to retrieve the text in passage. If my understanding is correct, how about this answer?
=importxml(A1, "//*[local-name()='passage']")
Result :
Note :
https://scaife-cts.perseus.org/api/cts?request=GetPassage&urn=urn:cts:greekLit:tlg0527.tlg001.opp-grc2:1.1 is converted by URL encode and put to "A1".
Converted URL is https://scaife-cts.perseus.org/api/cts?request=GetPassage&urn=urn%3acts%3agreekLit%3atlg0527%2etlg001%2eopp%2dgrc2%3a1%2e1.
Reference :
local-name
If this was not what you want, I'm sorry.

How can I access Google's search engine results programmatically and get the first URL with Autohotkey?

I want to access Google's search engine results programmatically and get the first URL with Autohotkey.
I can access google video search page but I don't know how can I parse the first video URL.
Send ^c
if !Html := UrlGet("https://www.google.com/search?tbm=vid&hl=en-TR&source=hp&biw=&bih=&q=%clipboard%") {
MsgBox No data returned from Google.com
return
}
The easiest way is to use a regex.
Add to your code:
RegExMatch(Html, "O)<h3 class=""r""><a href=""([^""]+)""", m)
MsgBox, % "The first result is: " m.1
You might want to further tailor the above regex pattern to your specific needs.

Google Custom search bug?

I have implemented google custom search (https://developers.google.com/custom-search/json-api/v1/reference/cse/list#request) that searches flickr and other sources on my site and now suddenly it gives me very wierd results.
My query looks like this (key and search engine id removed)
https://www.googleapis.com/customsearch/v1?num=10&rights=cc_attribute&searchType=image&safe=high&key={key}&cx={searchengine}&q=cat&start=1
So a search on 'cat' obviously gives totalResult:219000 in the response. I get 10 result per request but when I use start=11
https://www.googleapis.com/customsearch/v1?num=10&rights=cc_attribute&searchType=image&safe=high&key={key}&cx={searchengine}&q=cat&start=11
I get totalResults:12!
What am I doing wrong? This used to work.