Skip to content

Instantly share code, notes, and snippets.

View bitfishxyz's full-sized avatar
🐥
🐔🐔🥚🥚

medium003 bitfishxyz

🐥
🐔🐔🥚🥚
View GitHub Profile

Upon receiving a YouTube video link from the user, do the following:

  1. Extract the videoID from the video link.

  2. Use this videoID as a parameter to call the YouTubeCaption Action.

  3. If the return value is abnormal, inform the user of the reason for the abnormality.

  4. If the return value is normal, provide the user with a file download link using the following Python code:

    url = 'https://you-tube-caption-express-server-shuai1996.replit.app/?videoID=' + videoID
function cached(fn){
// Create an object to store the results returned after each function execution.
const cache = Object.create(null);
// Returns the wrapped function
return function cachedFn (str) {
// If the cache is not hit, the function will be executed
if ( !cache[str] ) {
let result = fn(str);
<!DOCTYPE html>
<html>
<body>
<form>
Username: <input type="text" name="username" />
Password:<input type="text" name="password" />
Email:<input type="text" name="email" />
const isString = value => typeof value === 'string';
const isSymbol = value => typeof value === 'symbol'
const isUndefined = value => typeof value === 'undefined'
const isDate = obj => Object.prototype.toString.call(obj) === '[object Date]'
const isFunction = obj => Object.prototype.toString.call(obj) === '[object Function]';
const isComplexDataType = value => (typeof value === 'object' || typeof value === 'function') && value !== null;
const isValidBasicDataType = value => value !== undefined && !isSymbol(value);
const isValidObj = obj => Array.isArray(obj) || Object.prototype.toString.call(obj) === '[object Object]';
const isInfinity = value => value === Infinity || value === -Infinity
// getBoundingClientRect
let imgList1 = [...document.querySelectorAll(".get_bounding_rect")]
let num = imgList1.length
let lazyLoad1 = (function () {
let count = 0
return function () {
let deleteIndexList = []
imgList1.forEach((img,index) => {
let rect = img.getBoundingClientRect()
const throttle = (func, time = 17, options = {
leading: true,
trailing: false,
context: null
}) => {
let previous = new Date(0).getTime()
let timer;
const _throttle = function (...args) {
let now = new Date().getTime();
const debounce = (func, time = 17, options = {
leading: true,
context: null
}) => {
let timer;
const _debounce = function (...args) {
if (timer) {
clearTimeout(timer)
}
if (options.leading && !timer) {
function curry(fn) {
if (fn.length <= 1) return fn;
const generator = (...args) => {
if (fn.length === args.length) {
return fn(...args)
} else {
return (...args2) => {
return generator(...args, ...args2)
const actions = ()=>{
const functionA = ()=>{/*do sth*/}
const functionB = ()=>{/*do sth*/}
const functionC = ()=>{/*send log*/}
return new Map([
[/^guest_[1-4]$/,functionA],
[/^guest_5$/,functionB],
[/^guest_.*$/,functionC],
//...
])
function cloneOtherType(target) {
const constrFun = target.constructor;
switch (toRawType(target)) {
case "Boolean":
case "Number":
case "String":
case "Error":
case "Date":
return new constrFun(target);
case "RegExp":