Getting complete description of video using YouTube API v3 - javascript

I am using YT API to fetch video description. I can use older API to fetch complete description of video using api call like this: API CALL
But using the newer API call truncates the description after 160 characters. example: https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=API_KEY_HERE&part=snippet&fields=items(snippet(title,description,categoryId))
Any idea about how I can get full description of a video from googleapis and not gdata.youtube(it is truncated).

I think you've confused things a bit with the request URLs you posted, as they are retrieving different types of data. Basically, with a search request (whether the search feed in the old V2 API that you've posted, or the search endpoint in the new V3 API which you didn't post an example of) will always return truncated descriptions. A videos request (which you have an example of for V3 but not for V2) will return the full video description. This is true for v2 or v3.

Related

Google Map Static Api with polyline not displaying on React Native

I am trying to add an image of a map using the Google Maps Static API in React Native.
I am using the directions api to obtain the overview_polyline data and incorporating that into a url that is then signed using the google cloud digital signature before being passed in to the source prop ({ uri: (my url)}) of Image.
The image is not rendered on screen with no error messages.
I have tried using fetch() in a trycatch statement and the response I get is:
The Google Maps Platform server rejected your request. Unable to authenticate the request. Provided 'signature' is not valid for the provided API key, or the provided 'key' is not valid.
The signature was checked against the URL: /maps/api/staticmap?&size=400x400&path=weight:3%257Ccolor:0x0352A0CC%257Cenc:(polyline)&key&mapID&signature.
However, when I use the exact same url in safari and chrome (with the same API key and signature) it renders the image.
I have tried:
this solution
this solution
both altered the url so it no longer worked in the browser.
Below is an example of a url I am using:
https://maps.googleapis.com/maps/api/staticmap?&size=400x400&path=weight:3%7Ccolor:0x0352A0CC%7Cenc:s~xdIxe~GyBh]mFpG{AqGs#qFmKgVoVaNjPkcAzJ{sBzc#qqA|XaxAwFc_A{Ywm#u[mOgYgc#}UiuAgVgtBsDaMkG`D_BaZpCadFfKmxBxXgn#hq#m\\nb#pCta#vNncAhKd`AzSp|#xUpk#yVvt#q^`_AzAlw#pT`l#r`#rfDdjAtn#b[jj#jcAl[pg#tj#ne#nn#jIxbAkB~wAaq#zl#aLnf#Rnc#dI~m#aBnwCzFj}A~a#j}#|B~h#eIxp#hS|`#xHl[_Gr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XXXXX
Use encodeURIComponent()
I used this function on the overview_polyline value returned from the directions api to convert the polyline to be uri compatible.
const encodeParseRes = encodeURIComponent(parseRes.route)
return (
`https://maps.googleapis.com/maps/api/staticmap?&size=500x500&path=weight:6%7Ccolor:0x0352A0CC%7Cenc:${encodeParseRes}&key=XXXXXXXXXX&map_id=XXXXXXXXXX`
)

How to get Youtube Video URL from catchphrase using javascript/node.js

I want to get the first video from youtube which is listed when I enter a certain catchphrase, e.g. when I enter 'Kill You Eminem' it should give me the URL for the first video, in this case 'https://www.youtube.com/watch?v=D1I1x2pYMK0'.
I want to achieve this using javascript/node.js
You can use the YouTube API to obtain data. Just use axios or the fetch api to create a get request to their endpoint and get the first item of the return array. Here is the complete documentation of YouTube's API. If you need help with the code, HMU in messages.
Here is sample for getting the most viewed videos:
GET {base_URL}/search?part=snippet
&forMine=true
&order=viewCount
&type=video
Here is the whole documentation of YouTube's API:
https://developers.google.com/youtube/v3/sample_requests

Get exact YouTube Subscribers

I'm using the YouTube API to build a live sub counter but as of now, YouTube has made some changes to their API and it now abbreviates the subscribers.
For example: if you use it on PewDiePie's channel it returns
subscriberCount: 10200000
I want it to return the exact number of subscribers.
Is there any other API or any way to circumvent this abbreviation?
This is the Request I'm making
GET https://www.googleapis.com/youtube/v3/channels?part=statistics&id=channel_id&key=your_key

Youtube API V3 get video details by URL

Recently , the youtube API has been updated to V3 , and I have a question:
How can I get the video details (views, name , description etc..) through Javascript using the url of the video ?
Example :
I have this url https://www.youtube.com/watch?v=DQ5w8LBI0kI&ab_channel=YT
and I want to get via Javascript the name and description of it.
How can I do this ?
You can find a detailed information about how to retrieve any kind of data you want in the official documentation of youtube api.Here
The API documentation is quite involved. Two good points to start from are the following:
YouTube Data API Overview, and
JavaScript Quickstart.
Upon reading them -- and surely more for that matter -- do come back with concrete (programming!) questions.
One more hint: the API endpoint that provides you with the information attached to a given video is Videos.list. But that doc page becomes meaningful only after you familiarize yourself with the surrounding (programming) environment.
Steps to achieve:
See the answer here to see how to get/parse video Id from a youtube video url.
After you get a videoId e.g. DQ5w8LBI0kI, you have to use that in the below API to get views, name, description etc.
https://www.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&id=DQ5w8LBI0kI&key=[YOUR_API_KEY]
See more about this Youtube API here

Find location of tower using google geolocation api

I am trying to find the location of cell towers using MNC, MCC, lac and CellID.
I have tried many api's such as opencell, combian etc. But none of them are free.
Is there any rest free API available, but for the moment I am using Google geolocation api.
I am sending request in javascript like this
https://www.googleapis.com/geolocation/v1/geolocate?key=xxx&homeMobileNetworkCode=410&homeMobileCountryCode=310&locationAreaCode=415&cellId=42&format=json
and all the time it return "Not Found"
I checked many places on stackover, but could not find good solution or hint. In addition is there any Free Api Available for getting operator name by using data mnc, mcc, cellid and lac.
In addition, I have also tried to use this link to get location but I could not as I can not find what parameter I need to pass and what should be the url I need to create.
Please provide me some guidelines to get location and operator name for specific tower by using information such as mnc, mcc etc.
Thanks appreciated
Google describes the geolocate API endpoint in their docs. You tried to do a GET request, but they say that you should use POST, with JSON-Formatted data:
Communication is done over HTTPS using POST. Both request and response are formatted as JSON, and the content type of both is application/json.
If you want to use the undocumented API from your link, the URL is http://www.google.com/glm/mmap and the POST-data is what is written in the function WriteData. See the Java Docs for DataOutputStream if you are unfamiliar with the output produced by the various write..-methods.
As for getting the operator name, there are free databases available for that (alternative 1, alternative 2; search google for more, there are plenty).

Categories

Resources