I have already tried calculating cost for search with list and snippet at https://developers.google.com/youtube/v3/determine_quota_cost and it shows 100.
Is there any additional cost for more parameters like chart and region code with search method.
To be specific, what will be the cost for the following query:
https://www.googleapis.com/youtube/v3/search?part=snippet&q=...&chart=mostRecent®ionCode=IN&key=...
No additional cost for queries.
The cost will be 100 for search with part=snippet.
Related
I'm using Google Sheets to organize data from my global royalty statements. Currently I'm querying several tabs (one for each country) to produce a single table with results from all countries. As you can imagine, I don't want 125 Japanese Yen showing up in my charts and graphs as $125 USD (125 Y is equivalent to about $1.09 USD).
Since I receive my royalty statements in their respective currencies, I'd like to apply average conversion rates either during the query operation or after the fact. Since the table is being generated dynamically, the values won't always be the same, so I need some way to apply the conversion by searching the list of currencies on the fly. I've got a separate table on the same tab containing all the average conversion rates for each currency. Here's a sample of how this is set up:
So basically I just don't know how to say, in coding terms, "If this line item comes from the UK, divide the royalty amount by the UK exchange rate. If it comes from Canada, divide by the Canadian rate, etc."
Anyone have any insight as to how I might pull this off (or whether it's possible)? The actual table includes over 500 line items from a dozen different countries, so doing this by hand is something I'd like to avoid.
I believe you are looking for the GoogleFinance() function. You may want to set the Country to a pick list of the valid country entries so you could create the string for the conversion. I have not looked at many, but this will take a value in CA & and apply the exchange rate to convert it to the US $ Equivalent. The exchange rate in this case is an average of, I believe, the past 30 days.
=C2 * GoogleFinance("CURRENCY:CADUSD" , "average")
For your use, you can get the country code from row M if you change it to match what the formula is after, such as CAD for Canadian Dollars."
=C2 * GoogleFinance("CURRENCY:" & M2 & "USD" , "average")
Another option would be to create a lookup table and use VLOOKUP or some other function, depending on how you set up your table.
I get that there is a cost incurred when I use YouTube API service, but what I would like to know is if the cost is per request or not.
For example, when I query the meta data of 3 videos, would the cost be tripled for that one request, or would the cost be the same as if I query the meta data for 1 video?
I assume you talk about the quota with the YouTube API v3, i can suggest you to visit this link, a quota calculator:
This tool lets you estimate the quota cost for an API query. All API requests, including invalid requests, incur a quota cost of at least one point.
https://developers.google.com/youtube/v3/determine_quota_cost COST 3
would the cost be tripled for that one request, or would the cost be the same as if I query the meta data for 1 video?
We can assume "cost be the same as if I query the meta data for 1 video" because they speaks about "request" like this :
GET https://www.googleapis.com/youtube/v3/videos?part=snippet COST 3
The request for multiple videos is like this :
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=zMbIipvQL0c%2CLOcKckBLouM&key={YOUR_API_KEY}
Which is also one request, so it's also a cost of 3 !
The real deal is when you have multiple pages:
Note: If your application calls a method, such as search.list, that returns multiple pages of results, each request to retrieve an additional page of results will incur the estimated quota cost.
I am making a bulk call with 30 posts and daily data of all. Is there any limits to the number of rows that will be returned by the API?
I am having problem getting the results.
Can anyone please help.
YouTube doesn't return any rows ... it's not relational data. That may sound like a pedantic thing to point out, but it's crucial for this next point; the API will return 50 videos at a time, along with tokens to get more results based on the same query, up to a total of 500 ... because the data isn't relational, you can't just "select all rows" that match a certain criteria. Rather, it is probabilistically determining relevance to your search parameters, and after about 500 results the algorithms don't have enough certainty to make additional results relevant.
So in your case, where you can change the date as needed (to allow the algorithms to be more specific), you'll want to do a series of calls; perhaps one at a time (since you have to paginate anyway to get more than 50 results, it's probably not that much more expensive in terms of network bandwidth).
Through a script I can collect a sequence of videos that search list returns. The maxresults variable was set to 50. The total number items are big in number but the number of next page tokens are not enough to retrieve all the desired results. Is there any way to take all the returned items or it is YouTube restricted?
Thank you.
No, retrieving the results of a search is limited in size.
The total results that you are allowed to retrieve seems to have been reduced to 500 (in the past it was limited to 1000). The api does not allow you to retrieve more from a query. To try to get more, try using a number of queries with different parameters, like: publishedAfter, publishedBefore, order, type, videoCategoryId, or vary the query tags and keep track of getting different video id's returned.
See for a reference:
https://code.google.com/p/gdata-issues/issues/detail?id=4282
BTW. "totalResults" is an estimation and its value can change on the next page call.
See: YouTube API v3 totalResults field is returning 1 000 000 when it shoudn't
Using elasticsearch, I'd like to get a histogram facet for a price field in my model. Without knowing beforehand the min and max prices, what I'd like is to have the histogram cover the entire range of prices, with a set number of intervals, say 10. I can see from the documentation at
http://www.elasticsearch.org/guide/reference/api/search/facets/histogram-facet.html
that I can specify the price range for each interval, but this would give me some unspecified number of intervals. I'd like to have some specific number of intervals that evenly cover the entire range of values for the price field. Is there any way to do this?
I know that one solution could be to query my database for the min and max values, and then figure out the appropriate interval size, but that goes against one of the main points of using elasticsearch, which is to not have to hit the db for search related queries.
You can query elasticsearch for min and max values using Statistical Facet
You can track progress on the implementation of this feature, referred to as auto_histogram, at https://github.com/elastic/elasticsearch/issues/31828