|
2 | 2 |
|
3 | 3 | Serves an e-commerce test website with a category-based structure for testing crawl depth: |
4 | 4 |
|
5 | | - / (depth 0) - Homepage with links to categories, about page, and deep chain |
| 5 | + / (depth 0) - Homepage with links to products, categories, about page, and deep chain |
6 | 6 | /categories/electronics (depth 1) - Links to products 1 and 2 |
7 | 7 | /categories/home (depth 1) - Links to product 3 |
8 | 8 | /about (depth 1) - About page |
9 | 9 | /deep/1 (depth 1) -> /deep/2 (depth 2) -> /deep/3 (depth 3) -> ... (infinite chain) |
10 | | - /products/1 (depth 2) - Widget A |
11 | | - /products/2 (depth 2) - Widget B |
12 | | - /products/3 (depth 2) - Widget C |
| 10 | + /products/1 (depth 1 or 2) - Widget A |
| 11 | + /products/2 (depth 1 or 2) - Widget B |
| 12 | + /products/3 (depth 1 or 2) - Widget C |
13 | 13 |
|
14 | | -With max_crawl_depth=2, the crawler reaches all products but does not go beyond /deep/2. |
| 14 | +The homepage includes both direct product links (for Scrapy spiders that look for /products/ links |
| 15 | +on the start page) and category links (for testing crawl depth with Crawlee crawlers). |
| 16 | +With max_crawl_depth=2, the crawler reaches all products and categories but does not go beyond /deep/2. |
15 | 17 | """ |
16 | 18 |
|
17 | 19 | from __future__ import annotations |
@@ -54,6 +56,9 @@ async def app(scope: dict[str, Any], _receive: Receive, send: Send) -> None: |
54 | 56 | send, |
55 | 57 | '<html><head><title>E-commerce Test Store</title></head><body>' |
56 | 58 | '<h1>Welcome to Test Store</h1>' |
| 59 | + '<a href="/products/1">Widget A</a>' |
| 60 | + '<a href="/products/2">Widget B</a>' |
| 61 | + '<a href="/products/3">Widget C</a>' |
57 | 62 | '<a href="/categories/electronics">Electronics</a>' |
58 | 63 | '<a href="/categories/home">Home & Garden</a>' |
59 | 64 | '<a href="/about">About Us</a>' |
|
0 commit comments