└── Google_Drive_Streamable_Link_Generator_for_Media_Files.ipynb /Google_Drive_Streamable_Link_Generator_for_Media_Files.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "Google Drive Streamable Link Generator for Media Files.ipynb", 7 | "provenance": [], 8 | "collapsed_sections": [] 9 | }, 10 | "kernelspec": { 11 | "name": "python3", 12 | "display_name": "Python 3" 13 | } 14 | }, 15 | "cells": [ 16 | { 17 | "cell_type": "markdown", 18 | "metadata": { 19 | "id": "ywcQdwyPlyHa", 20 | "colab_type": "text" 21 | }, 22 | "source": [ 23 | "## *Make sure your file is accessable by anyone with the link!*\n", 24 | "\n", 25 | "* It's helpful to have a publicly shared folder when creating links, then you won't have to edit the Share setting for each individual file.\n", 26 | "* This script should work with every type of URL Google Drive can generate. As long as the File ID is there, anything else shouldn't matter." 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": { 32 | "id": "oHr6jhgRn_5b", 33 | "colab_type": "text" 34 | }, 35 | "source": [ 36 | "\n", 37 | "\n", 38 | "---\n", 39 | "\n", 40 | "\n", 41 | "\n" 42 | ] 43 | }, 44 | { 45 | "cell_type": "markdown", 46 | "metadata": { 47 | "id": "4zic5dVfpgPq", 48 | "colab_type": "text" 49 | }, 50 | "source": [ 51 | "឵឵ ឵" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "metadata": { 57 | "id": "tf-nH8B1lStj", 58 | "colab_type": "code", 59 | "cellView": "form", 60 | "colab": {} 61 | }, 62 | "source": [ 63 | "#@title ← ឵឵ ឵Click Here to Generate Streamable Links\n", 64 | "import re\n", 65 | "\n", 66 | "shared_file_link = \"\" #@param {type:\"string\"}\n", 67 | "result = re.search(\"[\\w-]{33}\", shared_file_link)\n", 68 | "your_api_key = \"\" #@param {type:\"string\"}\n", 69 | "drive_file_id = result.group(0)\n", 70 | "\n", 71 | "beg_url = \"https://www.googleapis.com/drive/v3/files/\"\n", 72 | "end_url = \"/?key=\" + your_api_key + \"&alt=media\"\n", 73 | "\n", 74 | "print(beg_url + drive_file_id + end_url)" 75 | ], 76 | "execution_count": 0, 77 | "outputs": [] 78 | }, 79 | { 80 | "cell_type": "markdown", 81 | "metadata": { 82 | "id": "U1imKxNtpoAO", 83 | "colab_type": "text" 84 | }, 85 | "source": [ 86 | "឵឵ ឵" 87 | ] 88 | }, 89 | { 90 | "cell_type": "markdown", 91 | "metadata": { 92 | "id": "l-JR9_8XpNAF", 93 | "colab_type": "text" 94 | }, 95 | "source": [ 96 | "\n", 97 | "\n", 98 | "---\n", 99 | "\n" 100 | ] 101 | } 102 | ] 103 | } --------------------------------------------------------------------------------