Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • TTScraper

Index

Constructors

  • new TTScraper(cookiesPath?: string): TTScraper

Properties

_cookies: string
_cookiesJar: CookieJar = ...

Methods

  • TryFetch(link: string): Promise<any>
  • Checker to use Node-fetch over puppteer in case cookies were not required since it happens randomly

    Parameters

    • link: string

    Returns Promise<any>

  • checkJSONExisting(content: string): undefined | boolean
  • Trys to parse the JSON Object extracted from the Page HTML

    Parameters

    • content: string

      HTML DOM Content

    Returns undefined | boolean

  • downloadAllVideosFromUser(username: string, options: { path?: string; watermark?: boolean }): Promise<void>
  • Downloads all videos from a user page!

    Parameters

    • username: string

      tiktok username of the user

    • options: { path?: string; watermark?: boolean }

      download options

      • Optional path?: string
      • Optional watermark?: boolean

    Returns Promise<void>

  • extractJSONObject(html: string): string
  • Extract the JSON Object from the DOM with JavaScript instead of cheerio

    Parameters

    • html: string

      string

    Returns string

  • getAllVideosFromUser(username: string, noWaterMark?: boolean): Promise<IVideo[]>
  • Scrapes a user page and returns a list of all videos for this user

    Parameters

    • username: string

      tiktok username

    • Optional noWaterMark: boolean

      whether the returned videos should be without watermark

    Returns Promise<IVideo[]>

    IVideo[]

  • getMusic(link: string): Promise<Music>
  • Scrapes the given Link and returns information about the Music of the Video

    Parameters

    • link: string

      tiktok video url

    Returns Promise<Music>

    Music

  • handleHTMLContent(content: string): any
  • Replaces the window Object with a export string and writes the new JS file to work with the result as a JS Object

    deprecated

    No need for this function anymore since Tiktok now adds the json directly to the html in a seperated script tag

    Parameters

    • content: string

      the HTML content of the Page

    Returns any

  • hashTag(tag: string): Promise<IVideo[]>
  • noWaterMark(link: string): Promise<undefined | string | void>
  • Returns direct download link for the video with no watermark!

    Parameters

    • link: string

      tiktok video url

    Returns Promise<undefined | string | void>

    string

  • requestWebsite(baseUrl: string, fetchOptions?: RequestInit): Promise<CheerioAPI>
  • Fetches the website content and convert its content into text.

    Parameters

    • baseUrl: string

      baseUrl of the site to fetch

    • Optional fetchOptions: RequestInit

      node-fetch fetch options. Optional

    Returns Promise<CheerioAPI>

    Promise<cheerio.CheerioAPI>

    Example:

    const $ = await requestWebsite("https://www.amazon.de/s?k=" + "airpods")
    // => will return cheerio API Object to work with.

    $(".prices").each((_, value) => {
    console.log($(value).text().trim());
    });
  • requestWithPuppeteer(url: string): Promise<string>
  • user(username: string): Promise<User>
  • Scrapes the given user page and returns all available info

    Parameters

    • username: string

      tiktok username of a user

    Returns Promise<User>

    User

  • video(uri: string, noWaterMark?: boolean): Promise<void | Video>
  • Scrapes the tiktok video info from the given Link

    Parameters

    • uri: string

      tiktok video url

    • Optional noWaterMark: boolean

    Returns Promise<void | Video>

    Video

Generated using TypeDoc