diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2024-11-24 13:08:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-24 13:08:25 +0100 |
| commit | 26a033b3ec1269d3927831bda1749a484ed83733 (patch) | |
| tree | c3ff3641baea401f066ad1b80ac239faaa5b2605 /examples/useragents/firefox.js | |
| parent | d2aec146ac5a2aef4a87813be47e5e1dc7404c51 (diff) | |
Generate random user agent when non is provided (#76)
Diffstat (limited to 'examples/useragents/firefox.js')
| -rw-r--r-- | examples/useragents/firefox.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/useragents/firefox.js b/examples/useragents/firefox.js new file mode 100644 index 0000000..20d4d3c --- /dev/null +++ b/examples/useragents/firefox.js @@ -0,0 +1,13 @@ +import { parse } from "flyscrape"; + +export const config = { + url: "https://www.mozilla.org/en-US/firefox/releases/", +}; + +export default function ({ doc, absoluteURL }) { + const links = doc.find(".c-release-list a"); + return links + .map(link => link.text()) + .filter(Boolean) + .filter(version => parseFloat(version) >= 60); +} |