Skip to content

Instantly share code, notes, and snippets.

@wiedymi
Last active October 30, 2020 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wiedymi/fe9c0b305c234d7fa7ea8d1152674a3b to your computer and use it in GitHub Desktop.
Save wiedymi/fe9c0b305c234d7fa7ea8d1152674a3b to your computer and use it in GitHub Desktop.
function getGDriveEmbed(id) {
return `https://drive.google.com/file/d/${id}/preview`
}
function getGDriveId(url) {
let id = url.split("id=")[1];
if (!id) {
id = url.split("/d/")[1];
}
if (!id) {
id = id.split("/edit")[0];
}
if (id && id.includes('/')) {
id = id.split('/')[0]
}
return id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment