3.13.0 • Published 6 months ago

media-finder v3.13.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

:warning: This package is currently experimental and the API is both poorly documented and likely to change

Media Finder

Media Finder attempts to provide a consistent API to search for, and pull the metadata of, various types of media (images, video, gifs, etc) from a variety of sites and sources.

Search

import { createMediaFinderQuery } from "media-finder";

// Self-executing async function is used here simply to enable the use of await.
(async () => {
  // Search and return immediately the first page of results
  const response = await createMediaFinderQuery({
    request: {
      source: "giphy",
      queryType: "search",
      searchText: "cheese",
    },
    queryOptions: {
      secrets: {
        apiKey: process.env.GIPHY_API_KEY,
      },
    },
  }).getNext();
  // Prints the number of results in the first page
  console.log(`Got ${response?.media.length} gifs`);
})();

(async () => {
  // Alternatively create a query object which can be modified and iterated over
  const mediaQuery = createMediaFinderQuery({
    request: {
      source: "giphy",
      queryType: "search",
      searchText: "cake",
    },
    queryOptions: {
      fetchCountLimit: 3,
      secrets: {
        apiKey: process.env.GIPHY_API_KEY,
      },
    },
  });

  const media = [];

  for await (const response of mediaQuery) {
    media.push(...response.media);
  }

  console.log(`Got ${media.length} gifs in total`);
})();

Other

Media Finder can also be used with the media-finder-cli tool.

3.9.0

7 months ago

3.8.1

7 months ago

3.4.0

8 months ago

3.3.0

8 months ago

3.11.0

6 months ago

3.8.0

7 months ago

3.10.0

7 months ago

3.7.0

7 months ago

3.6.1

7 months ago

3.13.0

6 months ago

3.6.0

7 months ago

3.5.1

8 months ago

3.12.0

6 months ago

3.5.0

8 months ago

3.2.0

11 months ago

1.0.0

1 year ago

3.1.0

11 months ago

3.0.0

11 months ago

2.2.0

11 months ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

0.3.2

2 years ago

0.3.3

2 years ago

0.2.1

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.3

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago