graph search api no returning my public post - api

I am using graph search api to search a public post posted for me on my wall. Example:
https://graph.facebook.com/search?q=awstdw&type=post
My post contains the keyword "awstdw".
The above search not returning my post and this is a public post.
What's the problem?

You might need to wait for Facebook to update the cache on this term. It would show nothing if you happened to search for the term before posing something that contained it.
If you try: https://graph.facebook.com/search?q=facebook&type=post you will that it does work. Try creating a new post with a different keyword, and then try searching for it, e.g.
https://graph.facebook.com/search?q=asdasd&type=post

Related

How to use exactTerms and excludeTerms with Google Custom Search JSON API

I've been working with Google Custom Search API and faced some inconveniences I hope you can help me with.
Google Custom Search API offers as a parameter in its call the possibility to search by an exact text as well as exclude it from results: exactTerms and excludeTerms. However, the q parameter is mandatory and cannot be ignored, so if I want to search only by an specific text I just can't.
So how can I do a query using JSON API that contains specifically the text I want? Does the q parameter work as the search form in Google?
If I want results including 'foo', should I do this:
service.cse().list(cx=const.SEARCH_ENGINE_KEY, q='"foo"').execute()
or this?:
service.cse().list(cx=const.SEARCH_ENGINE_KEY, q=None, exactTerms='foo').execute()
Thank you in advance for your time.
Due to the success on the answers (hehe) I'm posting my own conclusions. Please, if you've any facts regarding the original question, please post it.
I've been testing with some calls to Google CSE API and looks like you can pass to q parameter the same query you'd do in Google's main page textfield. So (at least for my needs), you don't need exactTerms and excludeTerms to get what I was trying to achieve.
Anyway, as I said before, if you know how to work with these parameters I'm sure everybody will thank you.

Get wikitext from wikipedia API?

I'm looking at the API documentation here,
https://www.mediawiki.org/wiki/API:Query
Getting the wikitext for a page is mentioned in the beginning of the documentation,
The action=query module allows you to get information about a wiki and the data stored in it, such as the wikitext of a particular page, the links and categories of a set of pages, or the token you need to change wiki content.
but I cant seem to figure out what parameters to pass in the API request to return the wikitext for a given page. Anyone know how to do this?
I've tried parameters like,
{'action':'query', 'titles':'Anarchism', 'prop':'wikitext', 'format':'json'}
You must use this query .
https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Anarchism&rvslots=main

Instagram ?__a=1&max_id=<end_cursor> isn't working for public user feeds

I've been using Instagram's undocumented API https://www.instagram.com/<user>/?__a=1 to get a public user feed.
I was also able to get multiple pages via their max_id query parameter like so: https://www.instagram.com/<user>/?__a=1&max_id=<end_cursor>
end_cursor = json_response.graphql.user.edge_owner_to_timeline_media.page_info.end_cursor
(yes, "has_next_page" is true)
They had a recent change to their JSON format and I think they might have broken other functionality.
The "end_cursor" is still there but when I use it I just get back the same Instagram posts as if I wasn't using it.
Just to make sure I'm clear, my issue is that the max_id=<end_cursor> doesn't seem to work anymore for a public user feed. I can still get the first 12 posts, but no more after that.
Anyone else seeing this problem?
here's a JSFiddle example of what I mean:
https://jsfiddle.net/LLsg91ja/33/
04-14-2018 - NO LONGER WORKING - INSTAGRAM DEPRECATED THE '?__a=1' & '?query_id=17888483320059182' - THIS NO LONGER WORKS!
Okay take a look at this for media pagination:
https://instagram.com/graphql/query/?query_id=17888483320059182&id=<user_id>&first=12&after=<end_cursor>
This returns:
['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']
And Media:
['data']['user']['edge_owner_to_timeline_media']['edges']
the 'query_id' is static now so just use: 17888483320059182
'id' is the "instagram user id" so you have to use ?__a=1 to grab ['graphql']['user']['id']
'first' is the number of photos you desire returned. Just use 12 to keep the media return the same.
'after' is the new 'max_id' for use ['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']
I'll test more and respond later.
Responding Later:
It is believed 'pagination' using ?__a=1 has been deprecated. If true then there is no answer which can solve the op's direct question using ?__a=1 for Instagram pagination.
But the code provided in this answer will provide the pagination of Instagram media which does provide the results the op was seeking.
The answer incorporates the 'instagram graphql api' which is the current api (and not the json ?__a=1 hack) so this answer should provide some stability for now.
As used on my live site:
Grab the id=<instagram_user_id> prior the Instagram media request:
profile = https://www.instagram.com/<instagram_username>/?__a=1
media = https://instagram.com/graphql/query/?query_id=17888483320059182&id=<profile['graphql']['user']['id']>&first=12&after=<end_cursor>
You can use this: ?__a=1&page=3

Google Custom Search API curl trouble

I'm a newbie at stackoverflow so please be patient with me :)
I'm trying to get access with the Google Custom Search API.
But I get return that I can't understand.
My query is like this:
https://www.googleapis.com/customsearch/v1?&key=********&q=red%2Bsox&cx=**********&start=0&num=10&cr=countryCA&lr=lang_fr&client=google-csbe&output=xml_no_dtd
And the result I get is this?
string '{"error": {"errors": [{"domain": "global","reason": "invalid","message": "Invalid Value"}],"code": 400,"message": "Invalid Value"}}' (length=172)
What am I doing wrong?
I want the result from Google to appear.
Thanks in advance :)
You don't have a cx.
Take a look at this answer
What happens is because this api is used mostly for adding a search option
for your site you have to specify you custom search engine (e.g. search only your site).
When you want this to search the web by code you need to do the above. Add a fake
site (where you would add your search textbox), configure it (search the web, or your site, or whatever else) and then delete the fake site
Update
Oh god, i just saw that. Sorry. Well the problem is that you start with 0. Valid is 1. Change start=0 with start=1 and i think you would be good to go. Take a look at this for valid values for the start parameter official page

Facebook graph API not returning all mentions

I was having this problem with multiple searches, but here is one of them:
This is the post:
https://www.facebook.com/stefsasu/posts/207104452699707
that should appear in this search:
http://graph.facebook.com/search?q=mccain%20chips&type=post&locale=en_US
Am I doing something wrong?
Even if I delete the locale, the post still isn't there...
This search:
http://graph.facebook.com/search?q=mccain%20chips&type=post&locale=en_US
will not yield all the comments in Facebook that contain "mcCain chips" but rather search facebook for Applications\Pages that contain the search term. This is equivalent for searching in the little search-box on the top of FB's pages.
If you want to search in the comments of a specific user (e.g. Jake) you should fetch https://graph.facebook.com/me/feed?access_token=
and parse the results.
If you want to parse over all of Jake's feed you need to have an access token (which you will get if Jake or one of his friend will install your app, assuming the friend has granted the appropriate permissions).
Click the links on this page for deeper insights on the Graph API:
http://developers.facebook.com/docs/reference/api/
You can search over all PUBLIC objects only...Stefan Sasu account is not public...