UNPKG

instamancer

Version:

Scrape the Instagram API with Puppeteer

30 lines (29 loc) 1.34 kB
import * as puppeteer from "puppeteer"; import { Instagram, TFullApiPost, TPost, TSearchResult, TSinglePost } from ".."; export declare type DType = TPost | TSinglePost | TFullApiPost | TSearchResult; export interface IPluginContext<Plugin, PostType> { plugin: Plugin; state: Instagram<PostType>; } export interface IPlugin<PostType> { constructionEvent?(this: IPluginContext<IPlugin<PostType>, PostType>): void; requestEvent?(this: IPluginContext<IPlugin<PostType>, PostType>, req: puppeteer.Request, overrides: puppeteer.Overrides): Promise<void>; responseEvent?(this: IPluginContext<IPlugin<PostType>, PostType>, res: puppeteer.Response, data: { [key: string]: any; }): Promise<void>; postPageEvent?(this: IPluginContext<IPlugin<PostType>, PostType>, data: PostType): Promise<void>; graftingEvent?(this: IPluginContext<IPlugin<PostType>, PostType>): Promise<void>; } export declare enum AsyncPluginEvents { browser = 0, grafting = 1, postPage = 2, request = 3, response = 4 } export declare type AsyncPluginEventsType = keyof typeof AsyncPluginEvents; export declare enum SyncPluginEvents { construction = 0 } export declare type SyncPluginEventsType = keyof typeof SyncPluginEvents; export declare type PluginEventsType = SyncPluginEventsType | AsyncPluginEventsType;