I'm trying to learn how to work with YouTube API and it gave me this 404 (not found) error.
This is my code:
fetch("https://youtube.googleapis.com/youtube/v3/search?part=snippet&channelId=UCVSUF_SaDCLze2KiVrNkmrw&maxResults=10&order=date&key=AIzaSy...")
.then((result)=>{
return result.json()
}).then((data)=>{
console.log(data)
let videos = data.items
let container = document.querySelector(".youtube-container")
for(video of videos)
{
container.innerHTML += '<img src="${video.snippet.thumbnails.high.url}">'
}
})
anyone know what is the problem?
im working with vscode if its important
i tried to run this code and see the videos images but instead all i get is this error
"GET http://127.0.0.1:5500/$%7Bvideo.snippet.thumbnails.high.url%7D 404 (Not Found)"
Related
const request = {
name: copyTitle,
};
try {
gapi.client.drive.files.copy({
fileId: presentationId,
resource: request,
}).then((driveResponse) => {
const presentationCopyId = driveResponse.result.id;
if (callback) callback(presentationCopyId);
console.log('create copy_presentation with id', presentationCopyId);
});
} catch (err) {
document.getElementById('content').innerText = err.message;
return;
}
}
Whenever I deploy this in Google Apps script, I get Error 404 (404. That’s an error.
The requested URL /v1/scripts/AKfycbzr3AFNL9qvlzGV98zsJ3AsYxWv0Rx6pQK96A2sp0uPT0N1CzEHk4pF2FSFN5Jr7ZDO9w:run was not found on this server. That’s all we know) I'm running it as an executable API. It's meant to duplicate the presentation, and I tried it several times and got the same error. Sorry if this is a dumb question lol, I'm very new to coding
I am using video.js library to stream live video and it is working as expected
but after some time url throws a 404 error while streaming and the whole player will stuck on loading, now i want to catch that 404 error in any event and handle that
i also tried with player.on("error") but it is not firing when chunk is throwing 404
You can try listening to these events: playliststuck / retryplaylist. You can pass a callback function to .on method of the tech object.
Example:
const playerTech = player.tech({ IWillNotUseThisInPlugins: true });
playerTech.on('retryplaylist', (e) => { } );
playerTech.on('usage', (e) => { });
I installed new library videojs-errors
import videojs from 'video.js';
import 'videojs-errors';
which solved my problem with reach message options and customization
I'm trying to fetch an Api, but it keeps telling me there is a network error and I cant find a way anywhere to fix it.
const atlasApi = `Access-Control-Allow-Origin: https://atlas-obscura-api.herokuapp.com/api/atlas/destinations`
fetch(atlasApi).then(response => {
return response.json()
}).then(data => {
console.log(data)
})
Your api url seems incorrect, please try removing Access-Control-Allow-Origin: from the atlasApi. Then it should work fine.
PROBLEM
So im trying to create a twitter bot and everything was going fine until i tried to auto reply to users who follow me.
I'am learning and was watching from this tutorial Coding Train Twitter Bot(LINK) but i seem to get this error(PHOTO) even tho i did everything exactly the same.
Im Using:
Node.js
NPM
Windows CMD Command Prompt
Sublime Text 3
Importing Packages
var Twit = require('twit');
var Keys = require('./private_auth_keys');
var T = new Twit(Keys);
Stream Setup.
I belive the bug is somewhere in the stream part but i dont get it... i did everything the same as the video. Maybe twitter blocked this from their API? idk what im talking about, but any feedback would be awesome.
var stream = T.stream('user');
stream.on('follow', followed);
function followed(eventMsg) {
console.log("New Follower Reply Sent!");
var Name = eventMsg.source.name;
var screenName = eventMsg.source.screen_name;
tweetIt('Heyyy .#' + screenName + ' thanks for the follow! Do you like memes? #RateThatMeme');
}
Reply/Tweet Function
function tweetIt(txt) {
var tweet = {
status: txt
}
T.post('statuses/update', tweet, tweeted);
function tweeted(err, data, response) {
if (err) {
console.log("oof! Something went wrong!");
} else {
console.log("Tweet sent successfully!");
}
}
}
Error Message
events.js:167
throw er; // Unhandled 'error' event
^
Error: Bad Twitter streaming request: 401
at Object.exports.makeTwitError (C:\Users\admin\Desktop\Projects Code Train\node\node2\node_modules\twit\lib\helpers.js:74:13)....etc
Twitter user streams were retired in August so this code will no longer work as is.
401 status code means you are not unauthenticated - there should be additional WWW-Authenticate header in response that will tell you more.
I think twitter API changed since this tutorial was recorded and you have to do a bit more now to be able to access it, this is probably a reason for 401 status. as far as I can see, the author moved to mastodon with this tutorial lately because of that.
I have the following simple GET inside a function.
axios
.get(`/api/search/q=${this.value}`)
.then(res => {
console.log(res.data);
});
The GET 404's if I enter a query (the letter 'a' in this case):
GET http://localhost:7777/api/search/q=a 404 (Not Found)
so, of course I get an Uncaught promise error from the .then:
Uncaught (in promise) Error: Request failed with status code 404
I figured that it must be a simple routing problem, but my express route is:
router.get('/api/search', someController.someFunction)
The function in the controller works (ie responds with the data) as I have used it elsewhere in the app, so I feel that I have narrowed it down to the axios GET not finding the api. But I can't figure out why, as the path looks OK to me.
You were 404 getting because node is expecting only /api/search but your trying /api/search/:q which is different altogether, try
axios.get('/api/search/', {
params: {
q: value
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
since any number of parameters added will not make the URL clumsy, an alternate for
axios.get('/api/search?q=${this.value}').
and on the server
router.get('/api/search', someController.someFunction)
and in your controller
if(req.query.hasOwnProperty('q')){
var q = req.query.q;
}