Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ unlisted: true
---

import DocCardList from '@theme/DocCardList';
import UrlConditional from '@site/src/components/UrlConditional';

**Learn how to use JavaScript to extract information from websites in this practical course, starting from the absolute basics.**

---

<UrlConditional fragment="old-js-course">
:::tip
You're seeing this because your URL includes `#old-js-course`.
:::
</UrlConditional>

In this course we'll use JavaScript to create an application for watching prices. It'll be able to scrape all product pages of an e-commerce website and record prices. Data from several runs of such program would be useful for seeing trends in price changes, detecting discounts, etc.

![E-commerce listing on the left, JSON with data on the right](./images/scraping.webp)
Expand Down
7 changes: 7 additions & 0 deletions src/components/UrlConditional.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useLocation } from '@docusaurus/router';

export default function UrlConditional({fragment, children}) {

Check failure on line 3 in src/components/UrlConditional.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

A space is required before '}'

Check failure on line 3 in src/components/UrlConditional.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

A space is required after '{'
const location = useLocation();
const shouldShow = location.hash === `#${fragment}`;
return shouldShow ? <>{children}</> : null;
}
Loading