The url provided in this tutorial is broken due to some change in Google Drive. But don't despair. You need to extract another id from the url source code. I'm going to pass a code here that is working for me. You need to install axios and you need to have the imageid, which was provided by the video: const getViewerIdFromHTMLSourceCode = sourceCode => { if (!sourceCode) return null const splited = sourceCode.split('drive-viewer/') if (split.length < 2) return null const viewerId = splited[1].split('\\')[0] return viewerId } const getViewIdFromImageIdGoogleDrive = async photo_id => { try { const fetch = await axios.get(`drive.google.com/file/d/${photo_id}/view`) const viewid = getViewerIdFromHTMLSourceCode(fetch.data) return viewid } catch (err) { return null; } } With this code, use the getViewIdFromImageIdGoogleDrive function and put the photo_id as a parameter. You already have the photo_id, generated in this tutorial. This function returns a new id, in this case, which I call viewid. Then you use the following url lh3.googleusercontent.com/drive-viewer/[PUT THE VIEWID HERE] It's good to save this viewid in the database.
The url provided in this tutorial is broken due to some change in Google Drive. But don't despair. You need to extract another id from the url source code. I'm going to pass a code here that is working for me. You need to install axios and you need to have the imageid, which was provided by the video:
const getViewerIdFromHTMLSourceCode = sourceCode => {
if (!sourceCode) return null
const splited = sourceCode.split('drive-viewer/')
if (split.length < 2) return null
const viewerId = splited[1].split('\\')[0]
return viewerId
}
const getViewIdFromImageIdGoogleDrive = async photo_id => {
try {
const fetch = await axios.get(`drive.google.com/file/d/${photo_id}/view`)
const viewid = getViewerIdFromHTMLSourceCode(fetch.data)
return viewid
} catch (err) {
return null;
}
}
With this code, use the getViewIdFromImageIdGoogleDrive function and put the photo_id as a parameter. You already have the photo_id, generated in this tutorial.
This function returns a new id, in this case, which I call viewid. Then you use the following url lh3.googleusercontent.com/drive-viewer/[PUT THE VIEWID HERE]
It's good to save this viewid in the database.
The bessstt... Clear, simple, to the point, even for me that just starting code with nodejs... you deserve a medal.. 🏆
Awesome, thank you! This is the first building block for a great project!
Thx a lot man! The best explanation such material! Very sad that you have only 12 subscribers.
You are the BEEEEEEST. Thank you so much. You even wrote the code precisely how I would have written it which made me happy. Thanks man.
Thank you. As an English learner, it is an honour to have a compliment.
Thanks for your help! Subbed! I appreciate the help!
Nice one man! found exactly what i was looking for.
is there anyway to give permissions to specific emails after uploading the files ?
Need more tutorials bro
Really Thanks!
bro how to do with photos?