Extract file id from drive shareable link

📅️ Last Updated: January 29, 2021  • 📅️ Published: September 9, 2020  • 🕣 1 min read

I host my blog images on Google Drive sometimes, the normal shareable link is not the actual image source. Instead this is :


INSERT_ID is the file id (in the shareable link)which is higlighted below


here is a bash script to convert the link.

#!/usr/bin/env bash

# remove everything after the last /
# get everything after the last /
echo "https://drive.google.com/uc?export=view&id=$get_last"

Also a Python version

You can now use it in <img> src

Tired of fucking up with git everyday?

ugit helps you undo git commands with ease. Undo from 20+ git scenarios

ugit cli demo screen