Reddit API by_id request issues - reddit

I am attempting to send a batch of link ids to the reddit api. A few of my id's are not coming back in the response. Also, some of the posts in the results were not in the original requests. Am I doing something wrong with my request?
https://snap.apigee.com/W5wmLi
If you specifically look for this id t3_195m70 it is in the request, but not in the response. There are 25 id's in the request and 25 in the response.
I am baffled.

There are 25 id's in the request and 25 in the response.
There are 44 ids in the request. reddit by default limits your requests to 25 items. The limit can be extended up to 100 if you add ?limit=100 to the end of the URL. If you need to process more than 100 items, you need to make multiple requests.
Also, some of the posts in the results were not in the original requests
That does not appear to be the case.

Related

Get last page of GitHub Search Api result in iOS

I'm making a new iOS (swift) app to test some concepts, and I'm using the GitHub Serach API to retrieve a list of filtered repositories.
The request is working fine so far, but I'm having trouble understanding the pagination process and how to know I reached the end of the results.
For what I saw, the Search API returns a maximum of 1k results, broke in pages of 100 maximum results. But the field in the returned json with the total count shows way more available results (I imagine that it shows the total repositories that satisfy the query and not the maximum available for return in the API).
The only way I found so far to obtain information about the pages (and the pagination process) in GitHub Documentation comes in the header of the response, like:
Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
<https://api.github.com/resource?page=5>; rel="last"
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19
Anyone can suggest the best approach to detect the end of the pages in this case?
Should I try to parse the information from the header or infer it somehow based on the returned json? I even got the "Link" header value but don't know how to parse it.

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.

YouTube Content ID API : AssetSearch Issue

I am working on YouTube Content ID API to fetch assests which are added today.
First of all I try to explore API on YouTube Content ID API explorer and then find asset search suitable for my criteria.So I provided the required parameters and got the response but response include only 25 results each time so I used NextPageToken
recived from response to get next assests,so far so good ,but for all this responses I noticed the ResultsPerPage varies for each request which confused me.As I assumed that ResultsPerPage indicates the all assests for the particular content owner and considering this I decided to code but now I'm unable to decide how should procced.
Can any one help me to understand this
Both the totalResults and ResultsPerPage are not reliable, according to employees at YouTube. You can only rely on the data that comes through. You can verify this with your TAM/Partner Manager.
In order to get the real count of your assets (I'm assuming you're using AssetSearch?), you have to keep paginating until there's no "nextPageToken' in the response, and count your results.
By the way, if you set the parameter "maxResults=50" in your request, you'll get 50 per page (until there's less than 50 left to display, which should only happen on the last page, given that you have a number of assets not divisible by 50).

Why is the twitter list API not returning the correct number of results?

I'm using the twitter List API to get tweets from a set of accounts that I've added to a list. However, I'm noticing that for some reason I'm not receiving the correct number of tweets in the response from twitter. Here is my URL
https://api.twitter.com/1/lists/statuses.xml?list_id=68707107&per_page=30
I'm clearly asking for 30 results there, however if you just type that into a web browser you'll see it does not return 30 results. Does anyone know why this is?
Thanks!!
The per_page attribute it's an "up to" value. If you use the since_id you may get better results. And the pages in the api are being deprecated as you can read in the doc.
Work your solution using the since_id and max_id arguments in the api.
Check https://dev.twitter.com/docs/working-with-timelines
Check this answer: GET lists/statuses per_page returning unexpected results
Twitter may be limiting the number of tweets in requests to 20 so you could try downloading 20 and then load the next 10 after that.

Getting Twitter home timeline tweets

I am using Twitters REST api for the first time and I am a little confused by their documentation. I want to poll their API every ten minutes (to avoid the rate limits), retrieve the previous ten minutes of tweets and then do some processing on them.
I am using "GET statuses/home_timeline" to do this. The first part of the documentation says it will return the most recent 20 tweets but then says it will return up to 800 and then later on says it will return 200.
Could someone advise me on the correct method to use?
Thanks
EDIT: Documentation link: http://dev.twitter.com/doc/get/statuses/home_timeline
To get the home timeline (assuming you've already authenticated), you will have to GETthe Home Timeline like follows:
For XML:
http://api.twitter.com/1/statuses/home_timeline.xml
For JSON:
http://api.twitter.com/1/statuses/home_timeline.json
For RSS:
http://api.twitter.com/1/statuses/home_timeline.rss
For ATOM:
http://api.twitter.com/1/statuses/home_timeline.atom
It will return the latest 20 timelines (if no count attribute is passed), but it's maximum return statuses is limited to 800, if retweets are included.
The count attribute only allows you to pull more than 20 (default) statuses but you can request up to 200 maximum statuses (since Twitter has to include retweets).
Does that make sense?

Resources