Doc directory structure

This commit is contained in:
mrjvs
2023-12-26 23:35:58 +01:00
parent ddf612c6cc
commit 7143b06c55
27 changed files with 9071 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
# Introduction
- What is this project
- How does it work?
- What environments can it be ran in?

View File

@@ -0,0 +1,57 @@
# Quick start
- Prerequisites
- Install
- Scrape first item
Let's get started with `@movie-web/providers`. First lets install the package.
::code-group
```bash [NPM]
npm install @movie-web/providers
```
```bash [Yarn]
yarn add @movie-web/providers
```
```bash [PNPM]
pnpm install @movie-web/providers
```
::
## Scrape your first item
To get started with scraping on the **server**, first you have to make an instance of the providers.
```ts
import { makeProviders, makeDefaultFetcher, targets } from '@movie-web/providers';
// this is how the library will make http requests
const myFetcher = makeDefaultFetcher(fetch);
// make an instance of the providers library
const providers = makeProviders({
fetcher: myFetcher,
// will be played on a native video player
target: targets.NATIVE
})
```
Perfect, now we can start scraping a stream:
```ts [index.ts (server)]
// fetch some data from TMDB
const media = {
type: 'movie',
title: "Hamilton",
releaseYear: 2020,
tmdbId: "556574"
}
const output = await providers.runAll({
media: media
})
if (!output) console.log("No stream found")
console.log(`stream url: ${output.stream.playlist}`)
```

View File

@@ -0,0 +1,2 @@
icon: ph:book-open-fill
navigation.redirect: /get-started/introduction