Using the YouTube Data API V3 – quota very quickly runs out - discord.js

I am making a discord bot using discord.js and am using the YouTube API for music commands.
However, I managed to use up all of my quota just in testing. It can load playlists, search for songs and use urls and uses ytdl-core module to download the videos. Is it normal to use this much of a quota or is something wrong. I also noticed that you cannot get an extension for your quota without having an organisation, which I do not.

I'm running into the same problem. The YouTube Data API has a crazy low quota/limit. While the quota sounds reasonable, 10,000 queries per day, it's actually much lower. First, they count each query as 100. So take 10,000 and divide it by 100 and that's how many queries you are really allowed to make. Furthermore, they paginate their results with a maximum of 50 results (videos) per page. So in reality, YouTube will let you access data on 5,000 videos per day using the YouTube Data APIs search functionality. To confirm my math, I just checked my quota for the day. After querying the API for 10 pages of results (50 videos per page, 500 videos total) my quota/usage is listed at 1,000 out of the 10,000 allotment per day. Essentially, the YouTube Data API is useless.

Related

Number of online users and app visits in single page application

I making a SPA (single page application) and want to show the number of online users and app visits in the admin panel like this:
online users: 5 people
Today visits: 12 people.
This Year visits: 5263 people.
I don't know what the proper procedure is for implementing this.
What I'm doing as a solution is to make an endpoint at the server for computing number of online users and visits. In the client I've created a random string as UserKey and saved it into localStorage.Then I've used setInterval to send a request with UserKey payload to the endpoint every 5 minutes. This endpoint calculates the number of online users and visits based on UserKey and current date and time. Calculating Is not 100% Accurate but it's satisfactory for me.
I'm not sure if I'm in the right way. Please share me your advice.
You can simply do it with Navigator.onLine :
Source
Websockets (pusher) should be a right solution for your case. This way you don't have to poll every 5 minutes.
See https://pusher.com/docs/channels/getting_started/javascript/?ref=docs-index
It is free but just for 50 users if you want more users you can also choose to start an own Websocket server. Which is a little more complicated (without external libraries of course).

SalesForce Rest API calls Hourly limit

I have a batch process which makes a lot of rest api calls to upsert SalesForce records. The Rest api calls start failing after a while with below error.
I did check the API limit for my account and, I can confirm I am well within the 24 hour API limits.
Is there an hourly limit to the API calls as well ? I tried searching SalesForce documentation ,but everywhere I just see a mention about 24 hour limits.I could not find any limit on each hour basis.
{
“errorCode”: “REQUEST_LIMIT_EXCEEDED”,
“message”: “You have reached the Connect API’s hourly request limit for this user and application. Please try again later.”
}
You haven't hit the Salesforce API limit, which is generally quite high. You've hit the limit for the Chatter REST API, also known as the Connect API. This API has a per user, per application, per hour request limit:
Chatter REST API requests are subject to rate limiting. Chatter REST API has a different rate limit than other Salesforce APIs. Chatter REST API has a per user, per application, per hour rate limit. When you exceed the rate limit, all Chatter REST API resources return a 503 Service Unavailable error code.
The linked document has a number of recommendations for avoiding this rate limit:
If you hit limits when running tests, use multiple users to simulate a real-world scenario.
When polling for feed updates, do not exceed one poll per minute (60 polls per hour). To return more results in 1 request, increase the page size.
When polling for private messages, do not exceed 60 polls per hour.
To avoid making multiple requests, cache metered static assets such as file and dashboard renditions (group and user profile pictures are not metered).
Each developer on a team should set up 2 connected apps: one for automated testing and one for manual testing and development. Don’t share connected apps with other developers.
Use a unique connected app for the production environment.
Don’t share connected apps between applications.
Review the list of Chatter REST API resources to determine what you're calling that is subject to these enhanced limits.

Not sure where to find limits for Google Places Api free use

How much will I pay per month for 10k dau for an average geo location mobile game using google places (for POI)?
Here's a link to pricing and plans comparison link , but they are stated in requests so you need to calculate average request per user for your app and convert it to your 10k DAU

How much AppEngine Instance hours should I expected?

I have just developed a mobile apps which basically for users to upload, download photoes, add, update, search , delete, refresh transaction, and query report. Every action need submit request to Appengine Server.
I am using CloudEndpoint, oAuth2.0 and Objectify to implement this appengine. When I'm testing alone, The instance hours has used up 40% . How much billing for instance can I imagine if 100 people using this app? How does it calculate the instance hours? by request of submitting? or by time of instance working on multiple request??
is it worth?
If my target is more than 100 users to using my apps. Is it worth? Could you please share me what exactly I misunderstood about this instance.
Thanks
As others have commented, the question is very hard to answer. The easiest answer I can think of is by looking at the response header "X-AppEngine-Estimated-CPM-US-Dollars". You have to be a member of the Cloud Platform Project (see the Permissions page in Cloud Platform developers console) to see this header (you can check it in your browser).
The header tells you what the cost of the request was in US Dollars multiplied by 1000.
But think of it as an indication. If your request spawns other processes such as tasks, those costs are not included in the number you see in that header.
The relationship between Frontend instance hours and the number of requests is not linear either. For one, you will be charged a number of minutes (not sure if it's 15 minutes) when the instance spins up. And there are other performance settings that determine how this works.
Your best bet is to run the app for a while against real users and find out what the costs were in a given month or so.

Salesforce API 10 request limit

I read somewhere that the Salesforce API has a 10 request limit. If we write code to integrate with Salesforce:
1. What is the risk of this limit
2. How can we write code to negate this risk?
My real concern is that I don't want to build our customer this great standalone website that integrates with Salesforce only to have user 11 and 12 kicked out to wait until requests 1-10 are complete?
Edit:
Some more details on the specifics of the limitation can be found at http://www.salesforce.com/us/developer/docs/api/Content/implementation_considerations.htm. Look at the section titled limits.
"Limits
There is a limit on the number of queries that a user can execute concurrently. A user can have up to 10 query cursors open at a time. If 10 QueryLocator cursors are open when a client application, logged in as the same user, attempts to open a new one, then the oldest of the 10 cursors is released. This results in an error in the client application.
Multiple client applications can log in using the same username argument. However, this increases your risk of getting errors due to query limits.
If multiple client applications are logged in using the same user, they all share the same session. If one of the client applications calls logout(), it invalidates the session for all the client applications. Using a different user for each client application makes it easier to avoid these limits.*"
Not sure which limit you're referring to, but the governor limits are all listed in the Apex documentation. These limits apply to code running in a given Apex transaction (i.e. in response to a trigger/web service call etc), so adding more users won't hurt you - each transaction gets its own allocation of resources.
There are also limits on the number of long-running concurrent API requests and total API calls in a day. Most of these are per-license, so, again, as the number of users rises, so do the limits.
Few comments on:
I don't want to build our customer this great standalone website that integrates with Salesforce only to have user 11 and 12 kicked out to wait until requests 1-10 are complete?
There are two major things you need to consider when planning real-time Sfdc integration beside the api call limits mentioned in the metadaddy's answer (and if you make a lot of queries it's easy to hit these limits):
Sfdc has routine maintainance outage periods.
Querying Sfdc will always be significantly slower than a querying local datasource.
You may want to consider a local mirror of you Sfdc data where you replicate your Sfdc data.
Cheers,
Tymek
All API usage limits are calculated over 24 hours period
Limits are applicable to whole organization. So if you have several users connecting through API all of them count against the same limit.
You get 1,000 API requests per each Salesforce user. Even Unlimited Editions is actually limited to 5,000.
If you want to check your current API usage status go to Your Name |
Setup | Company Profile | Company Information
You can purchase additional API calls
You can read more at Salesforce API Limits documentation

Resources