<jupyter_start><jupyter_text>Python<jupyter_code>import requests
def download(file_id, dst_path):
    URL = "https://docs.google.com/uc?export=download"
    session = requests.Session()
    response = session.get(URL, params = { 'id' : file_id }, stream = True)

    for key, value in response.cookies.items():
        if key.startswith('download_warning'):
            params = { 'id' : file_id, 'confirm' : value }
            response = session.get(URL, params = params, stream = True)
            break

    with open(dst_path, "wb") as f:
        for chunk in response.iter_content(32768):
            if chunk:
                f.write(chunk)<jupyter_output><empty_output><jupyter_text>Bash<jupyter_code>%%bash

gdrive_download() {
    curl -c ./cookie.tmp -s -L "https://drive.google.com/uc?export=download&id=$1" > /dev/null
    curl -Lb ./cookie.tmp "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie.tmp`&id=$1" -o "$2"
    rm ./cookie.tmp
}

# Usage:
# gdrive_download file_id dst_path<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1529080675422139, 'fraction_numerical': 0.0075046904315197, 'mean_word_length': 3.234126984126984, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '600294', 'license': 'MIT', 'n_tokens_mistral': 375, 'n_tokens_neox': 363, 'n_words': 71, 'path': 'Downloading from Google Drive.ipynb', 'repo_name': 'apoorvkh/notebooks', 'size': '1066'}