Skip to content

Commit

Permalink
deploy: 34323a4
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Nov 28, 2023
1 parent f68ba42 commit b2f7d51
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
29 changes: 28 additions & 1 deletion crawl.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,34 @@ <h1 id="crawl"><a class="header" href="#crawl">Crawl</a></h1>
<pre><code class="language-ts">import { Website } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://rsseau.fr&quot;);
await website.scrape();

await website.crawl();
console.log(website.getLinks());
</code></pre>
<h2 id="async-event"><a class="header" href="#async-event">Async Event</a></h2>
<p>You can pass in a async function as the first param to the crawl function for realtime updates streamed.</p>
<pre><code class="language-ts">import { Website } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://rsseau.fr&quot;);

const onPageEvent = (err: Error | null, value: NPage) =&gt; {
console.log(value);
};

await website.crawl(onPageEvent);
</code></pre>
<h2 id="background"><a class="header" href="#background">Background</a></h2>
<p>You can run the request in the background and receive events with the second param set to <code>true</code>.</p>
<pre><code class="language-ts">import { Website } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://rsseau.fr&quot;);

const onPageEvent = (err: Error | null, value: NPage) =&gt; {
console.log(value);
};

await website.crawl(onPageEvent, true);
// this will run instantly as the crawl is in the background
</code></pre>

</main>
Expand Down
29 changes: 28 additions & 1 deletion print.html
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,34 @@ <h3 id="http2-prior-knowledge"><a class="header" href="#http2-prior-knowledge">H
<pre><code class="language-ts">import { Website } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://rsseau.fr&quot;);
await website.scrape();

await website.crawl();
console.log(website.getLinks());
</code></pre>
<h2 id="async-event"><a class="header" href="#async-event">Async Event</a></h2>
<p>You can pass in a async function as the first param to the crawl function for realtime updates streamed.</p>
<pre><code class="language-ts">import { Website } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://rsseau.fr&quot;);

const onPageEvent = (err: Error | null, value: NPage) =&gt; {
console.log(value);
};

await website.crawl(onPageEvent);
</code></pre>
<h2 id="background"><a class="header" href="#background">Background</a></h2>
<p>You can run the request in the background and receive events with the second param set to <code>true</code>.</p>
<pre><code class="language-ts">import { Website } from &quot;@spider-rs/spider-rs&quot;;

const website = new Website(&quot;https://rsseau.fr&quot;);

const onPageEvent = (err: Error | null, value: NPage) =&gt; {
console.log(value);
};

await website.crawl(onPageEvent, true);
// this will run instantly as the crawl is in the background
</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="cron-jobs"><a class="header" href="#cron-jobs">Cron Jobs</a></h1>
<p>Use a cron job that can run any time of day to gather website data.</p>
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.

0 comments on commit b2f7d51

Please sign in to comment.