Skip to content

Commit cb6a513

Browse files
committed
chore: added more books and support for cookie option in importer from amazon
1 parent e4d390e commit cb6a513

File tree

5 files changed

+81
-5
lines changed

5 files changed

+81
-5
lines changed

biome.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
33
"organizeImports": {
44
"enabled": true
55
},
@@ -14,7 +14,8 @@
1414
"noConsole": "off"
1515
},
1616
"correctness": {
17-
"all": true
17+
"all": true,
18+
"noUnusedImports": "warn"
1819
}
1920
},
2021
"ignore": ["coverage/", "dist/", "node_modules/", "docs/"]

scripts/importFromAmazon.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from 'node:fs'
22
import { readFile } from 'node:fs/promises'
33
import path from 'node:path'
44
import { Writable } from 'node:stream'
5+
import { parseArgs } from 'node:util'
56
import { load } from 'cheerio'
67
import slugify from 'slugify'
78
import TurndownService from 'turndown'
@@ -19,9 +20,18 @@ const rawBooksSlugs = new Set(
1920
(rawBooks || []).map((book: { slug: string }) => book.slug),
2021
)
2122

22-
const [, , ...ids] = process.argv
23+
const args = parseArgs({
24+
options: {
25+
cookie: {
26+
type: 'string',
27+
short: 'c',
28+
default: '',
29+
},
30+
},
31+
allowPositionals: true
32+
})
2333

24-
for (const id of ids) {
34+
for (const id of args.positionals) {
2535
const amazon_us = `https://www.amazon.com/dp/${id}`
2636
const amazon_uk = `https://www.amazon.co.uk/dp/${id}`
2737
const req = await fetch(amazon_us, {
@@ -52,12 +62,13 @@ for (const id of ids) {
5262
'User-Agent':
5363
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
5464
'Viewport-Width': '336',
65+
Cookie: args.values.cookie as string
5566
},
5667
})
5768
const content = await req.text()
5869

5970
if (content.includes("Sorry, we just need to make sure you're not a robot")) {
60-
console.error(`Skipping ${id} (captcha check!)`)
71+
console.error(`Skipping ${id} (captcha check!). Try to pass a valid Amazon.com cookie with the -c option.`)
6172
continue
6273
}
6374

src/books.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,3 +2463,67 @@
24632463
* Avoid scraping traps and bot blockers
24642464
* Use scrapers to test your website
24652465
2466+
- slug: acing-the-system-design-interview-1-zhiyong-tan
2467+
title: Acing the System Design Interview
2468+
edition: 1
2469+
authors:
2470+
- Zhiyong Tan
2471+
coverName: acing-the-system-design-interview-1-zhiyong-tan.jpg
2472+
links:
2473+
amazon_us: https://www.amazon.com/dp/1633439100
2474+
amazon_uk: https://www.amazon.co.uk/dp/1633439100
2475+
description: >-
2476+
The system design interview is one of the hardest challenges you'll face in
2477+
the software engineering hiring process. This practical book gives you the
2478+
insights, the skills, and the hands-on practice you need to ace the toughest
2479+
system design interview questions and land the job and salary you want.In
2480+
Acing the System Design Interview you will master a structured and organized
2481+
approach to present system design ideas like:
2482+
2483+
* Scaling applications to support heavy traffic
2484+
* Distributed transactions techniques to ensure data consistency
2485+
* Services for functional partitioning such as API gateway and service
2486+
mesh
2487+
* Common API paradigms including REST, RPC, and GraphQL
2488+
* Caching strategies, including their tradeoffs
2489+
* Logging, monitoring, and alerting concepts that are critical in any
2490+
system design
2491+
* Communication skills that demonstrate your engineering maturity
2492+
2493+
Don't be daunted by the complex, open-ended nature of system design
2494+
interviews! In this in-depth guide, author Zhiyong Tan shares what he's
2495+
learned on both sides of the interview table. You'll dive deep into the
2496+
common technical topics that arise during interviews and learn how to apply
2497+
them to mentally perfect different kinds of systems.
2498+
2499+
- slug: secrets-of-the-javascript-ninja-2-john-resig-bear-bibeault-josip-maras
2500+
title: Secrets of the JavaScript Ninja
2501+
edition: 2
2502+
authors:
2503+
- John Resig
2504+
- Bear Bibeault
2505+
- Josip Maras
2506+
coverName: secrets-of-the-javascript-ninja-2-john-resig-bear-bibeault-josip-maras.jpg
2507+
links:
2508+
amazon_us: https://www.amazon.com/dp/1617292850
2509+
amazon_uk: https://www.amazon.co.uk/dp/1617292850
2510+
description: >-
2511+
More than ever, the web is a universal platform for all types of
2512+
applications, and JavaScript is the language of the web. If you're serious
2513+
about web development, it's not enough to be a decent JavaScript coder. You
2514+
need to be ninja-stealthy, efficient, and ready for anything. This book
2515+
shows you how.
2516+
2517+
Secrets of the JavaScript Ninja, Second Edition uses practical examples to
2518+
clearly illustrate each core concept and technique. This completely revised
2519+
edition shows you how to master key JavaScript concepts such as functions,
2520+
closures, objects, prototypes, and promises. It covers APIs such as the DOM,
2521+
events, and timers. You'll discover best practice techniques such as
2522+
testing, and cross-browser development, all taught from the perspective of
2523+
skilled JavaScript practitioners.What's Inside
2524+
2525+
* Writing more effective code with functions, objects, and closures
2526+
* Learning to avoid JavaScript application pitfalls
2527+
* Using regular expressions to write succinct text-processing code
2528+
* Managing asynchronous code with promises
2529+
* Fully revised to cover concepts from ES6 and ES7
16.1 KB
Loading
22.4 KB
Loading

0 commit comments

Comments
 (0)