twdl
Version:
Downloads image and video tweets from Twitter
31 lines (30 loc) • 1.11 kB
TypeScript
/// <reference types="cheerio" />
import * as got from 'got';
import { AllOptions } from './options.js';
interface OptionsCommon {
uri?: string;
headers?: got.Headers;
body?: string;
}
export declare type OptionsWithUri = OptionsCommon & Partial<got.OptionsInit>;
export interface CheerioRoot extends cheerio.Root {
finalUrl: string;
}
export interface GotResponse<T = unknown> extends got.Response<T> {
finalUrl: string;
}
export declare function getUserAgent(useCustom?: string | boolean): string;
export declare function getRequestConfig(config: any, options: Partial<AllOptions>, userAgent?: string): any;
export declare enum RequestType {
FinalUrl = 0,
GetId = 1,
NitterMedia = 2,
NitterBio = 3,
PuppeteerMedia = 4,
VideoUrl = 5
}
export declare function downloadError(err: got.HTTPError & got.Response, requestType: RequestType): void;
export declare const gotInstance: got.Got;
export declare function getFinalUrl(url: string): Promise<string>;
export declare function loadCheerio(response: got.Response): CheerioRoot;
export {};