I get an error when adding title and description translation to some videos.
Methods I've Tried
I tested for invalid characters in the title and description I translated and found that there were no errors.
I sent This is a test video and This is a description for test purposes and it still gave an error.
Although I do not make any changes in the codes, it does not translate in some videos, but in others do.
The error:
Google.Apis.Requests.RequestError
The request metadata is invalid.[400]
Location[body-other]
Reason[invalidVideoMetadata]
Domain[youtube.video]]
My code:
VideoLocalization localization = new VideoLocalization();
localization.Title = "This is a test video";//Title
localization.Description = "This is a test description";//DESCRIPTION
video.Localizations.Add("en", localization);//INSERT LANGUAGE
var my_update_request = youtubeService.Videos.Update(video, "localizations, snippet, status");
await my_update_request.ExecuteAsync();
Related
Swagger-parser version: 2.1.1
Example swagger spec:
The test case is quite large, so I put it in a github gist. Don't be surprised by the names of the paths and schemes - I masked the critical data.
Description:
When using the ResolveFully option, I get requests with unresolved links. For example, take the request POST /v1/BusinePEH0JF. In swagger-ui it renders correctly - in the request body in the manager field, the Emplo4XN6X schema is resolved:
enter image description here
But swagger-parser gives this result:
enter image description here
Here the link is not resolved. This is most likely due to the fact that the parent schema BusinesYD77B4X in this request is stored as such in resolvedModels due to the fact that it is also used in other requests, such as POST /v1/ApprovalSetU0C9RY71SHD/manager-to-employees. Here, the manager field is empty, because this scheme has already been used above in the approver field.
enter image description here
Reproduction of the error:
val parseOptions = new ParseOptions()
parseOptions.setResolve(true)
parseOptions.setResolveFully(true)
val openAPI = new OpenAPIV3Parser().read(swaggerSpec, null, parseOptions)
Expected result:
Like on the first screen in swagger-ui
Thanks!
Seems like Youtube v3 playlist item insertion API (https://developers.google.com/youtube/v3/docs/playlistItems/insert) is responding with a wrong error message even though the video is successfully inserted into the playlist.
I went through the documentation and also searched for similar issues but have no clue why the youtube.playlistItems.insert call is failing.
I'm using googleapis node client to make this request. Here goes the code snippet:
let oauthConfig = config.oauthConfig;
let oAuthClient = new Google.auth.OAuth2(oauthConfig.clientId, oauthConfig.clientSecret);
oAuthClient.setCredentials({access_token: credentials.accessToken, refresh_token: credentials.refreshToken});
let youtubeApi = Google.youtube({version: 'v3', auth: _getOauthClient(_channel.credentials)});
youtube.playlistItems.insert({
part: 'snippet',
resource: {
snippet: {
playlistId: playlist.id,
resourceId: {
kind: 'youtube#video',
videoId: video.id
}
}
}
}, function (err) {
});
Here the callback method receives
404 Video not found.
at Request._callback (<proj_dir>/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.self.callback (<proj_dir>//node_modules/google-auth-library/node_modules/request/request.js:187:22)
The doc mentioned above says,
notFound (404) - videoNotFound - The video that you are trying to add to the playlist cannot be found. Check the value of the videoId property to ensure that it is correct.
Calling the above code with playlist: PL4D56EB46ED904B8A and video: 4HlpCEEwdxk has resulted in this error, but both video and playlist has public visibility and seems correct. More surprisingly the video uploaded correctly and was inserted into the correct playlist (I verified by visiting https://studio.youtube.com/video/4HlpCEEwdxk/edit/basic), so it seems like a false error.
The same code works for different video without any error though. I'm clueless about what is wrong here. Any help is much appreciated. Thanks
I have been using pushbullet in the software R (RPushbullet package) to message me when a script finishes. It worked nicely with my notebook and Iphone, however, with the workstation it is not working. The followiing message is returned:
Warning message:
400: Bad Request - Usually this results from missing a required parameter.
I have installed pushbullet in three devices: my workstation, my personal notebook and in my Iphone.
From this, I have observed some things that can be related to the problem: 1) The Access Token is lost every time I restart a session in my online account; 2) Although the setup return a valid key message from my .rpushbullet.json file after the configuration, the API key cannot be retrieved by another code.
My R script:
> require(RPushbullet)
> require(jsonlite)
> pbSetup() #Creating my setup to "~/.rpushbullet.json" file
Please enter your API key (aka 'Access Token': "my API key"
[1] "1. iPhone de XXXXX"
[1] "2. XXXXX"
Select a default device (0 for none): 1
> pbValidateConf(conf = "~/.rpushbullet.json")
key is VALID
device XXX is VALID
device XXX is VALID
[1] TRUE
> pbPost("note", "The R Script worked")
Warning message:
400: Bad Request - Usually this results from missing a required parameter.
> pbGetUser(apikey = .getKey())
Error in .getKey() : could not find function ".getKey"
"my API key" and XXX are valid things that I omitted in the example code
pbPost("note", "The R Script worked")
This code is enough to post to all my devices (when using my notebook), even lacking the other parameters
apparently pbPost() is a little bit picky about the parameter it receives. You need to at least specify type, title and body. As in:
pbPost(type="note", title="testTitle", body="testBody")
If you enter these 3 parameters it should work fine.
Regarding your points 1) and 2), indeed the token is lost and you need to force RPushbullet to read your .json file again. This next workaround works for me, though: I don't create a .json file but instead I pass the key and device id directly to the pbPost().
gimme_a_shout_when_finished = TRUE
if (gimme_a_shout_when_finished){
library(jsonlite)
library(RPushbullet)
my_phone_id = "xxx...myphoneid...xxx"
my_PB_apikey = "xxx...myapikey...xxx"
pbPost(type = "note", title = "my tile", body = "my body",
apikey = my_PB_apikey, devices = my_phone_id, verbose = FALSE,
debug = FALSE)
}
This has been working for me so far. Regarding getting the apikey directly... no ideas for the moment.
Hope this helps.
I'm trying to upload videos using https://code.google.com/p/youtube-api-samples/source/browse/samples/java/youtube-cmdline-uploadvideo-sample/src/main/java/com/google/api/services/samples/youtube/cmdline/youtube_cmdline_uploadvideo_sample/UploadVideo.java example
I've successfully registered on the youtube console and have obtained the client_secrets.json at https://code.google.com/apis/console/?api=youtube#project:340964720118:access
I have installed the secrets so my app can access them; everything is compiled well, but when the program is executed, I'me getting that strange errors:
GoogleJsonResponseException code: 400 : Invalid value for: listed is not a valid value
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Invalid value for: listed is not a valid value",
"reason" : "invalid"
} ],
"message" : "Invalid value for: listed is not a valid value"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
I can't find out what is wrong; since the request itself is deeply encapsulated, I can't understand what is wrong with the request...
UPD.
Thanks to
System.out.println(videoInsert.getHttpContent().toString());
call inserted before the
Video returnedVideo = videoInsert.execute();
in the sample code, I got that the JSOn formed and sent to the google is
{snippet={description=Video uploaded via YouTube Data API V3 using the Java library on Sun Sep 29 20:29:30 MSK 2013, tags=[test], title=Test Upload via Java on Sun Sep 29 20:29:30 MSK 2013}, status={privacyStatus=listed}}
But actually there is still a question what is wong with this json and why it causes the error on the the server side.
UPD 2:
And no I no longer get the message above, but the upload is still impossible. I'm getting 401 Error while trying to upload the file in that lines of the example above:
System.out.println(videoInsert.getJsonContent().toString());
System.out.println(videoInsert.getHttpContent().getType());
Video returnedVideo = videoInsert.execute();
System.out.println(returnedVideo.getId());
I supposed that I haven't authorized the request to my personal data, but I actually DID it (the request was loaded to the default browser where I have accepted it and specified the account I would like to work with). However, there is no way to check that authoriation; my google account data holds only Apps and Activity log for the google+ apps; I haven't fount my app in the list. So where I can check where I'm not logged in?
IOException: 401 Unauthorized
com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at ScreenRecordingExample.UploadToYoutube(ScreenRecordingExample.java:356)
Ok, I have found out that the problem appeared due to the incorrect privacyStatus value:
I had
status.setPrivacyStatus("listed");
in my code, while it seems that only public, unlisted and private are possible values
And the UPD-2 problem was resolved unfortunately in the way i don't know exactly how:
i have noticed, that in my code example there was a line
return new AuthorizationCodeInstalledApp(flow, localReceiver).authorize("user");
I have replaced 'user' with my google user name (but actually I'm not sure that it was a thing that was really needed). After that replacement the authorization attempt started again (default browser loaded the accept/decline page and there I should select one of two accounts). Since I have two accounts, the original youtube one and the common google one, and during the last attempt I have selected the google's one and got 401 error, I have selected the youtube's one this time.
so, after that the problem was resolved. I still don't know do it due to the correct username instead of 'user' or due to the correct account selection. If someoune kows the truth, please comment!
I have the following snippet to post to a user's feed on Facebook:
require 'httparty'
token = "..."
message = "..."
url = URI.escape("https://graph.facebook.com/me/feed?access_token=#{token}")
response = HTTParty.post(url, body: { message: message })
This posts to the wall, but no message is included. Any ideas what's wrong?
Edit:
I tried changing out the message for a caption or description and both failed as well.
Solution is to change HTTParty from using body to query for posting form data:
require 'httparty'
token = "..."
message = "..."
url = URI.escape("https://graph.facebook.com/me/feed?access_token=#{token}")
response = HTTParty.post(url, query: { message: message })
Based on the link cited above, it appears message functionality has been completely removed from the feed connection since July 12.
This is a problem for my current app as it is specifically a public opinion site. Asking users to express their opinions authentically is an important part of our design and we'd like to give them the option to post that to their feeds on Facebook as well.
Per the Facebook terms of use IV.2, "You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow." The new change appears to change the terms of service: in my use, I am specifically asking the user to generate the content earlier in the workflow, but I still can't use it to pre-fill the feed dialog.
Anyone have any ideas or insight?