{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "wget_google_drive.ipynb",
      "version": "0.3.2",
      "provenance": [],
      "collapsed_sections": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/gmihaila/machine_learning_toolbox/blob/master/wget_google_drive.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "metadata": {
        "id": "n-deHoiMAG2b",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "## Downloading file from google drive using wget\n",
        "\n",
        "GitHub Repo: https://github.com/pavanjadhaw/gdown.pl\n",
        "\n",
        "\n",
        "\n",
        "### Get gdown.pl file\n",
        "\n",
        "```\n",
        "wget https://raw.githubusercontent.com/pavanjadhaw/gdown.pl/master/gdown.pl && chmod u+x gdown.pl\n",
        "\n",
        "```\n",
        "\n",
        "### To use if follow this:\n",
        "\n",
        "\n",
        "```\n",
        "./gdown.pl \"link to file\" file.mp4\n",
        "\n",
        "```\n",
        "\n",
        "\n"
      ]
    },
    {
      "metadata": {
        "id": "ROPy-9Mg_-7l",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 71
        },
        "outputId": "2f4a0060-13e0-443f-9e58-923728b4ecff"
      },
      "cell_type": "code",
      "source": [
        "# used to clean console\n",
        "from IPython.display import clear_output\n",
        "\n",
        "# example link: https://drive.google.com/open?id=1mq4pg5Ch1Ypc5Dl5FtuZJkASBCqUojEj\n",
        "\n",
        "print(\"Downloading gdown.pl...\")\n",
        "!wget https://raw.githubusercontent.com/pavanjadhaw/gdown.pl/master/gdown.pl && chmod u+x gdown.pl\n",
        "clear_output()\n",
        "\n",
        "print(\"Downloading google drive file...\")\n",
        "!./gdown.pl \"https://drive.google.com/file/d/1-vycAliFEcTieEnwLyjTbgLvuJPewol0/view\" data.zip\n",
        "clear_output()\n",
        "\n",
        "print(\"Unzip...\")\n",
        "!unzip data.zip\n",
        "clear_output()\n",
        "\n",
        "print(\"Done!\")\n",
        "!ls"
      ],
      "execution_count": 22,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "all\t\t\t      all.zip\t  gdown.pl.2\t      polyps_split7.zip\n",
            "All\t\t\t      gdown.pl\t  labeled_imaged.csv  sample_data\n",
            "all_dominos_image+labels.zip  gdown.pl.1  polyps_split7\n"
          ],
          "name": "stdout"
        }
      ]
    }
  ]
}