Commit 913f480
Add attribute extraction support with @Attribute syntax
Implemented attribute extraction for CSS selectors using @ syntax:
Features:
- Syntax: "selector@attribute" (e.g., "a@href", "img@src", "img@alt")
- Works in both extractText() and extractHtml() functions
- Supports any HTML attribute (href, src, alt, title, data-*, etc.)
- Returns attribute values instead of text content or HTML
- Maintains single value vs array logic based on element count
Examples:
- "a@href" → Extract link URLs
- "img@src" → Extract image sources
- "img@alt" → Extract alt text
- ".article-headline a@href" → Extract links from specific articles
This enables the naming convention system in bookmarklets:
{
"headlines": ".article-headline",
"headlines_link": ".article-headline a@href",
"thumbnails_src": "img.thumbnail@src"
}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 48464d5 commit 913f480
1 file changed
+35
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
17 | 31 | | |
18 | 32 | | |
| 33 | + | |
19 | 34 | | |
20 | 35 | | |
21 | 36 | | |
22 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
23 | 40 | | |
24 | 41 | | |
25 | 42 | | |
26 | 43 | | |
27 | 44 | | |
28 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
29 | 53 | | |
30 | 54 | | |
31 | 55 | | |
32 | 56 | | |
33 | 57 | | |
34 | 58 | | |
| 59 | + | |
35 | 60 | | |
36 | 61 | | |
37 | 62 | | |
38 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
39 | 66 | | |
40 | 67 | | |
41 | 68 | | |
42 | 69 | | |
43 | 70 | | |
44 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
45 | 77 | | |
46 | 78 | | |
47 | 79 | | |
| |||
0 commit comments