Skip to content

Commit

Permalink
deploy: 3682664
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Nov 29, 2023
1 parent 847dfa4 commit 5cf3ea1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
20 changes: 18 additions & 2 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,24 @@ <h3 id="events"><a class="header" href="#events">Events</a></h3>

const links: NPage[] = [];

const onPageEvent = (err: Error | null, value: NPage) =&gt; {
links.push(value);
const onPageEvent = async (err: Error | null, page: NPage) =&gt; {
links.push(page);
};

// params in order event, background, and headless chrome
await website.crawl(onPageEvent);
console.log(website.getLinks());
</code></pre>
<h3 id="selector"><a class="header" href="#selector">Selector</a></h3>
<p>The <code>title</code> method allows you to extract the title of the page.</p>
<pre><code class="language-ts">import { Website, pageTitle } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://choosealicense.com&quot;);

const links = [];

const onPageEvent = async (err: Error | null, page: NPage) =&gt; {
links.push( { title: pageTitle(page), url: page.url });
};

// params in order event, background, and headless chrome
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

20 changes: 18 additions & 2 deletions simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,24 @@ <h3 id="events"><a class="header" href="#events">Events</a></h3>

const links: NPage[] = [];

const onPageEvent = (err: Error | null, value: NPage) =&gt; {
links.push(value);
const onPageEvent = async (err: Error | null, page: NPage) =&gt; {
links.push(page);
};

// params in order event, background, and headless chrome
await website.crawl(onPageEvent);
console.log(website.getLinks());
</code></pre>
<h3 id="selector"><a class="header" href="#selector">Selector</a></h3>
<p>The <code>title</code> method allows you to extract the title of the page.</p>
<pre><code class="language-ts">import { Website, pageTitle } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://choosealicense.com&quot;);

const links = [];

const onPageEvent = async (err: Error | null, page: NPage) =&gt; {
links.push( { title: pageTitle(page), url: page.url });
};

// params in order event, background, and headless chrome
Expand Down

0 comments on commit 5cf3ea1

Please sign in to comment.