Last active
October 30, 2020 13:50
-
-
Save wiedymi/fe9c0b305c234d7fa7ea8d1152674a3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getGDriveEmbed(id) { | |
return `https://drive.google.com/file/d/${id}/preview` | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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