Getting only the most recent tweet - Monkeh Tweets - twitter

I'm using ColdFusion MonkehTweets component. But actually, all I'm trying to do is get the single most recent tweet for #allblacks.
Here is the URL MonkehTweets generates. I have blanked out the keys etc for the purposes of this post:
https://api.twitter.com/1.1/search/tweets.json?checkheader=false&count=1&include_entities=true&lang=en&oauth_consumer_key=blah123&oauth_nonce=blah123&oauth_signature=blah123&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1378795729&oauth_token=blah123&oauth_version=1.0&q=from%253Aallblacks
This constantly returns the first Tweet on 7th September at https://twitter.com/allblacks
instead of the latest tweet.
Not sure what's going on and would appreciate some help please.

According to documentation: https://dev.twitter.com/docs/api/1.1/get/search/tweets you could use the optional parameter result_type with value recent. That should return only the most recent results in the response.
And I'd use #allblacks for the q parameter.

Related

Youtube - ListChannels with Username(forUsername) is not working

I'm trying to get channels info with ChannelsList. This endpoint has a parameter the name is: forUsername but it does not work for this page: https://www.youtube.com/c/FolkartTr
This is my query and it returns empty data:
Somehow, I got this channelID in the page source and its: "channelId":"[UCnS--2e1yzQCm5r4ClrMJBg]".
When I try to query with this ID it's okay and returns with correct data.
and this is its payload: http://jsonblob.com/941253671862419456
How will I be able to reach this channel info using a username? I got a few links with usernames and I want to get their info with their username. I don't have any chance to get their channelID's for all.
Thanks for your help.
If I understood correctly, your problem is that you can't do anything from such a username with the Channels: list of the YouTube Data API v3. If you're just looking for the channel id linked to this username then because as YouTube Data API v3 doesn't work for this, I would recommend you to use my open-source YouTube operational API, indeed by requesting https://yt.lemnoslife.com/channels?part=snippet&forUsername=FolkartTr you'll receive a JSON with id equals to the channel id linked to the provided forUsername value.
If you have any question don't hesitate to comment or come to the Discord support.
Notice that the channel title and the channel customUrl might be different.
In your example - http://jsonblob.com/941253671862419456 -, the channel title is Folkart, but its customUrl - which is the value you get when view on YouTube - is: folkarttr.
Note the difference in both case-sensitive and additional letters.
For these reasons, you should not based your channel search by name, but, rather, by its channel_id.
If you really need to search by userName, the answer from Benjamin Loison can solve your requirement.
See if you can find a ticket on Issue Tracker or post your issue there too. Then, you might get some official answer.

Pushshift.io seems to return the wrong submission count?

I am using https://pushshift.io/ API endpoint, to get the count of submissions of my user's subreddit page (e.g 'u_username').
From what I understand it should something has to do with the API, because i get the JSON response correct, but when I count the objects they are more than the expected.
I tried several methods to count the JSON array with PHP count() and sizeof(), but these are not seem to be the problem. The problem may be in the API.
In PHP:
file_get_html('https://api.pushshift.io/reddit/search/submission/?subreddit=u_USERNAME&filter=id&sort=desc&size=500');
For posts more that 500, you should change the 'size' paramater.
I have 232 post and i get back 240... How is this possible?
Is there any other way to count my subreddit user page posts/submissions?
Thank you.
If a post has been deleted or removed, it is still recorded by Pushshift (they aren't removed from Pushshift when they are deleted or removed). This is the principle behind removeddit and ceddit.

ITunes Search API page number for the query

Is there any way to get results of next page of a search query? When I give page parameter, I get the same results from ITunes as:
https://itunes.apple.com/search?country=us&limit=200&entity=software&term=a
and
https://itunes.apple.com/search?country=us&limit=200&entity=software&term=a&page=2
gives the same output. Giving page parameter works for customer reviews.
Is there any way to get the results of next page?
According to API documentation there is no way but I found a lot of useful answers which are not indicated in API documentation.
I found a way to query more records. There is a parameter called offset, which is not mentioned in API documentation.
https://itunes.apple.com/search?term=a&offset=25&limit=25
Enjoy!
Actually there is no pagination in apple search API. It will only return maximum first 200 records.
Below is reference URL for same:
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#searching
Thank you.

Twitter: Number of tweets OR get more tweets

I would like to know how can I get all tweets from a certain hash tag?
I am currently using the following code:
xhr.open("GET","http://search.twitter.com/search.json?q=%23PrayForJapan");
This only returns me 15 tweets. Does anyone know how to make it return more?
Also, I have got a code to get me the tweets of a certain screen name, this only returns 20 tweets, how can i ask the following 20 tweets?
The code i used for that is:
xhr.open("GET","http://api.twitter.com/1/statuses/user_timeline.json?screen_name=Eminem");
I'm using titanium to create this, but I don't think that is an issue?
Thanks!
You can usually add count=x as parameter to the query string to get up to x tweets (for the search api it seems to be rpp). Query string parameters are added to the base url via ? and each individual parameter is then separated by & as in http://api?user=1&count=4
Most of the time, it is better though to remember the last tweets and then add ?since_id=x as this way you only get tweets you did not see before.
Have a look at the api documentation.

Twitter API - Display all tweets with a certain hashtag?

How would I go about displaying tweets that contain a certain hashtag using the Twitter API? Thanks
I'd also like to know if there is a way to get all tweets from a certain hashtag in a separate file, also the ones that don't show up in your feed anymore. I suppose that's what the earlier question was about, too.
This answer was written in 2010. The API it uses has since been retired. It is kept for historical interest only.
Search for it.
Make sure include_entities is set to true to get hashtag results. See Tweet Entities
Returns 5 mixed results with Twitter.com user IDs plus entities for the term "blue angels":
GET http://search.twitter.com/search.json?q=blue%20angels&rpp=5&include_entities=true&with_twitter_user_id=true&result_type=mixed
UPDATE for v1.1:
Rather than giving q="search_string" give it q="hashtag" in URL encoded form to return results with HASHTAG ONLY. So your query would become:
GET https://api.twitter.com/1.1/search/tweets.json?q=%23freebandnames
%23 is URL encoded form of #. Try the link out in your browser and it should work.
You can optimize the query by adding since_id and max_id parameters detailed here. Hope this helps !
Note: Search API is now a OAUTH authenticated call, so please include your access_tokens to the above call
Updated
Twitter Search doc link:
https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html
The answer here worked better for me as it isolates the search on the hashtag, not just returning results that contain the search string. In the answer above you would still need to parse the JSON response to see if the entities.hashtags array is not empty.

Resources