-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
693 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Page | ||
|
||
A single page on a website, useful if you just need one or the root url. | ||
|
||
## New Page | ||
|
||
Get a new page with content. | ||
|
||
The first param is the url, followed by if subdomains should be included, and last to include TLD's in links. | ||
|
||
Calling `page.fetch` is needed to get the content. | ||
|
||
```ts | ||
import { Page } from "@spider-rs/spider-rs"; | ||
|
||
const page = new Page("https://choosealicense.com", false, false); | ||
await page.fetch(); | ||
``` | ||
|
||
## Page Links | ||
|
||
get all the links related to a page. | ||
|
||
```ts | ||
|
||
const page = new Page("https://choosealicense.com", false, false); | ||
await page.fetch(); | ||
const links = await page.getLinks(); | ||
console.log(links); | ||
``` | ||
|
||
## Page Html | ||
|
||
Get the markup for the page or HTML. | ||
|
||
```ts | ||
|
||
const page = new Page("https://choosealicense.com", false, false); | ||
await page.fetch(); | ||
const html = page.getHtml(); | ||
console.log(html); | ||
``` | ||
|
||
## Page Bytes | ||
|
||
Get the raw bytes of a page to store the files in a database. | ||
|
||
```ts | ||
|
||
const page = new Page("https://choosealicense.com", false, false); | ||
await page.fetch(); | ||
const bytes = page.getBytes(); | ||
console.log(bytes); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.