Skip to content

Instantly share code, notes, and snippets.

@visionarylab
visionarylab / submit.md
Created June 14, 2024 05:55 — forked from tanaikech/submit.md
Resumable Download of File from Google Drive using Drive API with Python

Resumable Download of File from Google Drive using Drive API with Python

This is a sample script for achieving the resumable download of a file from Google Drive using Dive API with Python.

There might be a case in that you want to achieve the resumable download of a file from Google Drive using Dive API with Python. For example, when a large file is downloaded, the downloading might be stopped in the middle of downloading. At that time, you might want to resume the download. In this post, I would like to introduce the sample script of python.

In order to achieve the partial download from Google Drive, the property of Range: bytes=500-999 is required to be included in the request header. But, unfortunately, in the current stage, MediaIoBaseDownload cannot use this property. When MediaIoBaseDownload is used, all data is downloaded.

So, in order to achieve this goal, it is required to use a workaround. In this workaround, I proposed the following flow.

Note: This is all almost full YouTube ID informations. Original owner goes to AgentOak, modified version by Martin Eesmaa.

See the credits and also special thanks in below.

Last updated: June 2024

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

@visionarylab
visionarylab / streaming-responses-200.js
Created June 4, 2024 08:16 — forked from harrishancock/streaming-responses-200.js
Cloudflare Workers streaming response bodies example with unconditional 200
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
/**
* Make multiple requests,
* aggregate the responses and
* stream it back as a single response.
*/
async function fetchAndApply(request) {
@visionarylab
visionarylab / markmission.md
Created May 21, 2024 03:03 — forked from sfinktah/markmission.md
OpenAI's idea of how to create a PWA for offline/online submission of form data

Creating a Progressive Web App (PWA) to store contact details from a form and submit them when internet access is available involves a combination of technologies like HTML, CSS, JavaScript, and service workers. Below is a simplified example of how you can achieve this:

  1. HTML Form: Create an HTML form to collect contact details. You can create an index.html file.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
@visionarylab
visionarylab / Cargo.toml
Created January 1, 2024 02:37 — forked from carsonfarmer/Cargo.toml
SQLite and CAS: An Experimental Edge in Edge Compute Platforms
[package]
name = "rust-sqlite-test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.72"
byteorder = "1.4.3"
@visionarylab
visionarylab / cloudflare-worker-youtube-dl.js
Created November 6, 2020 12:59 — forked from hizkifw/cloudflare-worker-youtube-dl.js
Download YouTube videos with Cloudflare Worker
/**
* cloudflare-worker-youtube-dl.js
* Get direct links to YouTube videos using Cloudflare Workers.
*
* Usage:
* GET /?v=dQw4w9WgXcQ
* -> Returns a JSON list of supported formats
*
* GET /?v=dQw4w9WgXcQ&f=251
* -> Returns a stream of the specified format ID
@visionarylab
visionarylab / HTML5_player.html
Created September 25, 2020 15:37 — forked from BackFront/HTML5_player.html
Pseudo Streaming MP4’s with PHP
<video controls="" width="400">
<source src="http://66.128.61.175/reel/1cc976948e74aa62f7a7fde16e64fb6b/360p" type="video/mp4">
Your browser does not support HTML5 video.
</video>