UNPKG

instamancer

Version:

Scrape the Instagram API with Puppeteer

172 lines (171 loc) 5.58 kB
import * as t from "io-ts"; import { IPlugin } from "../../plugins"; import { IOptions } from "./api"; import { Instagram } from "./instagram"; export declare const Users: t.TypeC<{ position: t.NumberC; user: t.TypeC<{ full_name: t.StringC; has_anonymous_profile_picture: t.BooleanC; is_private: t.BooleanC; is_verified: t.BooleanC; latest_reel_media: t.NumberC; mutual_followers_count: t.NumberC; pk: t.StringC; profile_pic_id: t.UnionC<[t.StringC, t.UndefinedC]>; profile_pic_url: t.StringC; username: t.StringC; }>; }>; export declare const Places: t.TypeC<{ place: t.TypeC<{ header_media: t.AnyC; location: t.TypeC<{ address: t.StringC; city: t.StringC; external_source: t.StringC; facebook_places_id: t.NumberC; lat: t.UnionC<[t.UndefinedC, t.NumberC]>; lng: t.UnionC<[t.UndefinedC, t.NumberC]>; name: t.StringC; pk: t.StringC; short_name: t.StringC; }>; media_bundles: t.UnknownArrayC; slug: t.StringC; subtitle: t.StringC; title: t.StringC; }>; position: t.NumberC; }>; export declare const Hashtags: t.TypeC<{ hashtag: t.TypeC<{ id: t.StringC; media_count: t.NumberC; name: t.StringC; profile_pic_url: t.StringC; search_result_subtitle: t.StringC; use_default_avatar: t.BooleanC; }>; position: t.NumberC; }>; export declare const SearchResult: t.TypeC<{ clear_client_cache: t.BooleanC; has_more: t.BooleanC; hashtags: t.ArrayC<t.TypeC<{ hashtag: t.TypeC<{ id: t.StringC; media_count: t.NumberC; name: t.StringC; profile_pic_url: t.StringC; search_result_subtitle: t.StringC; use_default_avatar: t.BooleanC; }>; position: t.NumberC; }>>; places: t.ArrayC<t.TypeC<{ place: t.TypeC<{ header_media: t.AnyC; location: t.TypeC<{ address: t.StringC; city: t.StringC; external_source: t.StringC; facebook_places_id: t.NumberC; lat: t.UnionC<[t.UndefinedC, t.NumberC]>; lng: t.UnionC<[t.UndefinedC, t.NumberC]>; name: t.StringC; pk: t.StringC; short_name: t.StringC; }>; media_bundles: t.UnknownArrayC; slug: t.StringC; subtitle: t.StringC; title: t.StringC; }>; position: t.NumberC; }>>; rank_token: t.StringC; status: t.StringC; users: t.ArrayC<t.TypeC<{ position: t.NumberC; user: t.TypeC<{ full_name: t.StringC; has_anonymous_profile_picture: t.BooleanC; is_private: t.BooleanC; is_verified: t.BooleanC; latest_reel_media: t.NumberC; mutual_followers_count: t.NumberC; pk: t.StringC; profile_pic_id: t.UnionC<[t.StringC, t.UndefinedC]>; profile_pic_url: t.StringC; username: t.StringC; }>; }>>; }>; export declare type TSearchResult = t.TypeOf<typeof SearchResult>; export declare type ISearchOptions = Pick<IOptions, Exclude<keyof IOptions, "total" | "fullAPI" | "hibernationTime" | "sleepTime">>; export interface ISearchOptionsPlugins<PostType> extends ISearchOptions { plugins?: IPlugin<PostType>[]; } export declare class Search extends Instagram<TSearchResult> { readonly catchURL = "https://www.instagram.com/web/"; private searchResult; private readonly searchQuery; private readonly inputElementQuery; constructor(query: string, options?: ISearchOptions); get(): Promise<{ clear_client_cache: boolean; has_more: boolean; hashtags: { hashtag: { id: string; media_count: number; name: string; profile_pic_url: string; search_result_subtitle: string; use_default_avatar: boolean; }; position: number; }[]; places: { place: { header_media: any; location: { address: string; city: string; external_source: string; facebook_places_id: number; lat: number; lng: number; name: string; pk: string; short_name: string; }; media_bundles: unknown[]; slug: string; subtitle: string; title: string; }; position: number; }[]; rank_token: string; status: string; users: { position: number; user: { full_name: string; has_anonymous_profile_picture: boolean; is_private: boolean; is_verified: boolean; latest_reel_media: number; mutual_followers_count: number; pk: string; profile_pic_id: string; profile_pic_url: string; username: string; }; }[]; }>; matchURL(url: string): boolean; protected processResponseData(data: TSearchResult): Promise<void>; }