This GAS sample is for retrieving access token to use OneDrive APIs using Google Apps Script.
In this script, the authorization code is automatically retrieved.
| name: ecstatic_allen | |
| services: | |
| main_app: | |
| cpu_shares: 50 | |
| command: [] | |
| container_name: nginx-proxy | |
| deploy: | |
| resources: | |
| limits: | 
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Main script for udemy-dl.""" | |
| from __future__ import unicode_literals | |
| from __future__ import print_function | |
| from builtins import str | |
| from builtins import input | |
| import json | |
| import re | 
| /** | |
| ** Author: @MonokaiJs | |
| ** Contact: monokaijs@northstudio.vn | https://fb.me/monokaijssss | monokaijs.com | |
| ** | |
| ** Free to use, but don't abuse :> | |
| **/ | |
| (()=>{let a=location.href.match(/\/(?:videos|reel|watch)(?:\/?)(?:\?v=)?(\d+)/);if(a.length<2){console.log("Please open a video before running this script.");return}let c=function(d,e){let f=[],a;for(a in d)if(d.hasOwnProperty(a)){let g=e?e+"["+a+"]":a,b=d[a];f.push(null!==b&&"object"==typeof b?c(b,g):encodeURIComponent(g)+"="+encodeURIComponent(b))}return f.join("&")},b=function(a,b){return fetch("https://www.facebook.com/api/graphql/",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:c({doc_id:a,variables:JSON.stringify(b),fb_dtsg:require("DTSGInitialData").token,server_timestamps:!0})})};console.log("Getting info..."),b("5279476072161634",{UFI2CommentsProvider_commentsKey:"CometTahoeSidePaneQuery",caller:"CHANNEL_VIEW_FROM_PAGE_TIMELINE",displayCommentsContextEnableComment:null,displayCommentsContextIsAdPreview:null,displayComm | 
| { | |
| "restartable": "rs", | |
| "ignore": [".git", "node_modules/", "dist/", "coverage/"], | |
| "watch": ["src/"], | |
| "execMap": { | |
| "ts": "node -r ts-node/register" | |
| }, | |
| "env": { | |
| "NODE_ENV": "development" | |
| }, | 
| // ---- | |
| // libsass (v3.2.5) | |
| // ---- | |
| // Color Map | |
| $colors: ( | |
| blue: #0000FF, | |
| red: ( | |
| base: #FF0000, | |
| light: #EEEEFF, | 
| "use strict"; | |
| /** | |
| * Hypertext Transfer Protocol (HTTP) response status codes. | |
| * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes} | |
| */ | |
| enum HttpStatusCode { | |
| /** | |
| * The server has received the request headers and the client should proceed to send the request body | 
In order to use this script, please retrieve client id, client secret and refresh token before. About this, you can see the detail information at https://gist.github.com/tanaikech/d9674f0ead7e3320c5e3184f5d1b05cc.
This is for the simple item upload is available for items with less than 4 MB of content. The detail information is https://dev.onedrive.com/items/upload_put.htm.
var fs = require('fs');
var mime = require('mime');
var request = require('request');| var fs = require('fs'); | |
| var request = require('request'); | |
| var EventEmitter = require('events').EventEmitter; | |
| var mime = require('mime'); | |
| var util = require('util'); | |
| function resumableUpload() { | |
| this.byteCount = 0; //init variables | |
| this.tokens = {}; | |
| this.filepath = ''; |