0
I’m doing some tests with API
of BLOGGER and in the tests I performed I managed to reach a certain point that is to add content to articles via API
.
Page where I’m doing my tests:
https://developers.google.com/blogger/docs/3.0/reference/posts/publish
However I would like to make a change to this script.
Behold:
<script src="https://apis.google.com/js/api.js"></script>
<script>
/**
* Sample JavaScript code for blogger.posts.insert
* See instructions for running APIs Explorer code samples locally:
* https://developers.google.com/explorer-help/guides/code_samples#javascript
*/
function authenticate() {
return gapi.auth2.getAuthInstance()
.signIn({scope: "https://www.googleapis.com/auth/blogger"})
.then(function() { console.log("Sign-in successful"); },
function(err) { console.error("Error signing in", err); });
}
function loadClient() {
gapi.client.setApiKey("YOUR_API_KEY");
return gapi.client.load("https://content.googleapis.com/discovery/v1/apis/blogger/v3/rest")
.then(function() { console.log("GAPI client loaded for API"); },
function(err) { console.error("Error loading GAPI client for API", err); });
}
// Make sure the client is loaded and sign-in is complete before calling this method.
function execute() {
return gapi.client.blogger.posts.insert({
"blogId": "blogId",
"resource": {
"content": "\n<div class=\"separator\" style=\"clear: both; display: none; text-align: center;\">\n<object class=\"BLOG_video_class\" contentid=\"ID\" height=\"266\" id=\"BLOG_video-ID\" width=\"320\"></object>\n<br />\nID<br />\n<br />\n</div>\n\t"
}
})
.then(function(response) {
// Handle the results here (response.result has the parsed body).
console.log("Response", response);
},
function(err) { console.error("Execute error", err); });
}
gapi.load("client:auth2", function() {
gapi.auth2.init({client_id: "YOUR_CLIENT_ID"});
});
</script>
<button onclick="authenticate().then(loadClient)">authorize and load</button>
<button onclick="execute()">execute</button>
The code that the site provided me has a Button to run the script, would run the script by direct url? hosting the script accessing it?
In the content part of the article I would need to send this code the way it is, but only changes the "ID", I would have to edit the code whenever I run it, see that there are 3 ID in this code:
"content": "\n<div class=\"separator\" style=\"clear: both; display: none; text-align: center;\">\n<object class=\"BLOG_video_class\" contentid=\"**ID**\" height=\"266\" id=\"BLOG_video-**ID**\" width=\"320\"></object>\n<br />\n**ID**<br />\n<br />\n</div>\n\t"
It would be possible to change these direct ID on url
execution?
Example:
http://site/meuscritpt.com/?ID= nova-ID
As the ID in url
the effect would be the same inside the script.
A while ago I saw something similar here on the site but am not finding more.
It is not clear what really needs, very broad the subject, could create a minimal example?
– novic
I’m trying to access the videos sent to the blogger by url with a direct link like this : https://tudogostoso.blog/make/check/? list=e6dac2f91 I’ll reform the question to see if it becomes clearer.
– Endou
I repeat the question here https://answall.com/questions/414450/acessar-conte%C3%bado-atr%C3%a1ves-de-api-blogger
– Endou