evoscrape 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: evoscrape
3
+ Version: 0.1.0
4
+ Summary: AI-powered self-healing web scraper
5
+ Requires-Python: >=3.10
@@ -0,0 +1,666 @@
1
+ \# EvoScrape ๐Ÿค–
2
+
3
+
4
+
5
+ AI-Assisted Self-Healing Web Scraper
6
+
7
+
8
+
9
+ \## ๐Ÿ“Œ About
10
+
11
+
12
+
13
+ EvoScrape is an AI-assisted web scraper that can automatically recover when a website changes its HTML structure or CSS selectors.
14
+
15
+
16
+
17
+ Traditional web scrapers can break when a website changes something like:
18
+
19
+
20
+
21
+ ```text
22
+
23
+ \[data-testid="price"]
24
+
25
+ ```
26
+
27
+
28
+
29
+ to:
30
+
31
+
32
+
33
+ ```text
34
+
35
+ .product-price
36
+
37
+ ```
38
+
39
+
40
+
41
+ EvoScrape detects the broken selector, analyzes the current webpage, finds possible replacement elements, scores them, validates the best candidate, saves the new selector, and continues scraping.
42
+
43
+
44
+
45
+ \## โœจ Features
46
+
47
+
48
+
49
+ \* ๐Ÿ”Ž Live webpage inspection
50
+
51
+ \* ๐ŸŽฏ CSS selector validation
52
+
53
+ \* ๐Ÿง  Intelligent candidate scoring
54
+
55
+ \* ๐Ÿ”ง Automatic selector healing
56
+
57
+ \* ๐Ÿงช Replacement selector validation
58
+
59
+ \* ๐Ÿ’พ Automatic selector updates
60
+
61
+ \* ๐Ÿ“Š Healing confidence scores
62
+
63
+ \* ๐Ÿ“ Healing history logs
64
+
65
+ \* ๐Ÿ“ฆ Product data extraction
66
+
67
+ \* ๐Ÿš€ One-command execution
68
+
69
+
70
+
71
+ \## ๐Ÿง  How EvoScrape Works
72
+
73
+
74
+
75
+ ```text
76
+
77
+ Saved Selector
78
+
79
+   โ”‚
80
+
81
+   โ–ผ
82
+
83
+ Check Selector
84
+
85
+   โ”‚
86
+
87
+   โ”œโ”€โ”€ โœ… Works โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Extract Data
88
+
89
+   โ”‚
90
+
91
+   โ””โ”€โ”€ โŒ Failed
92
+
93
+   โ”‚
94
+
95
+   โ–ผ
96
+
97
+   Discover Candidates
98
+
99
+   โ”‚
100
+
101
+   โ–ผ
102
+
103
+   Score Candidates
104
+
105
+   โ”‚
106
+
107
+   โ–ผ
108
+
109
+   Best Candidate
110
+
111
+   โ”‚
112
+
113
+   โ–ผ
114
+
115
+   Validate Selector
116
+
117
+   โ”‚
118
+
119
+   โ–ผ
120
+
121
+   Save New Selector
122
+
123
+   โ”‚
124
+
125
+   โ–ผ
126
+
127
+   Extract Data
128
+
129
+ ```
130
+
131
+
132
+
133
+ \## ๐Ÿ—๏ธ Project Structure
134
+
135
+
136
+
137
+ ```text
138
+
139
+ EvoScrape/
140
+
141
+ โ”‚
142
+
143
+ โ”œโ”€โ”€ run.py
144
+
145
+ โ”œโ”€โ”€ demo.py
146
+
147
+ โ”œโ”€โ”€ README.md
148
+
149
+ โ”‚
150
+
151
+ โ”œโ”€โ”€ ai/
152
+
153
+ โ”‚ โ”œโ”€โ”€ \_\_init\_\_.py
154
+
155
+ โ”‚ โ”œโ”€โ”€ auto\_heal.py
156
+
157
+ โ”‚ โ”œโ”€โ”€ healer.py
158
+
159
+ โ”‚ โ”œโ”€โ”€ scorer.py
160
+
161
+ โ”‚ โ””โ”€โ”€ validator.py
162
+
163
+ โ”‚
164
+
165
+ โ”œโ”€โ”€ config/
166
+
167
+ โ”‚ โ”œโ”€โ”€ selectors.json
168
+
169
+ โ”‚ โ””โ”€โ”€ healing\_log.json
170
+
171
+ โ”‚
172
+
173
+ โ””โ”€โ”€ website/
174
+
175
+   โ”œโ”€โ”€ index.html
176
+
177
+   โ””โ”€โ”€ index\_backup.html
178
+
179
+ ```
180
+
181
+
182
+
183
+ \## โš™๏ธ Technologies Used
184
+
185
+
186
+
187
+ \* Python
188
+
189
+ \* Playwright
190
+
191
+ \* BeautifulSoup
192
+
193
+ \* HTML
194
+
195
+ \* CSS Selectors
196
+
197
+ \* JSON
198
+
199
+ \* PowerShell
200
+
201
+
202
+
203
+ \## ๐Ÿ“ฆ Requirements
204
+
205
+
206
+
207
+ Python 3.10 or newer.
208
+
209
+
210
+
211
+ Install the required packages:
212
+
213
+
214
+
215
+ ```bash
216
+
217
+ pip install playwright beautifulsoup4
218
+
219
+ ```
220
+
221
+
222
+
223
+ Install the Playwright browser:
224
+
225
+
226
+
227
+ ```bash
228
+
229
+ playwright install chromium
230
+
231
+ ```
232
+
233
+
234
+
235
+ \## ๐Ÿš€ Running EvoScrape
236
+
237
+
238
+
239
+ \### Step 1 โ€” Start the test website
240
+
241
+
242
+
243
+ Open a PowerShell terminal inside the EvoScrape folder and run:
244
+
245
+
246
+
247
+ ```powershell
248
+
249
+ python -m http.server 8000 --directory website
250
+
251
+ ```
252
+
253
+
254
+
255
+ Keep this terminal running.
256
+
257
+
258
+
259
+ \### Step 2 โ€” Open another PowerShell
260
+
261
+
262
+
263
+ Go to the project folder:
264
+
265
+
266
+
267
+ ```powershell
268
+
269
+ cd C:\\Users\\rick\\Desktop\\EvoScrape
270
+
271
+ ```
272
+
273
+
274
+
275
+ Activate the virtual environment:
276
+
277
+
278
+
279
+ ```powershell
280
+
281
+ .\\venv\\Scripts\\Activate.ps1
282
+
283
+ ```
284
+
285
+
286
+
287
+ \### Step 3 โ€” Run EvoScrape
288
+
289
+
290
+
291
+ ```powershell
292
+
293
+ python .\\run.py
294
+
295
+ ```
296
+
297
+
298
+
299
+ \## ๐Ÿงช Self-Healing Demo
300
+
301
+
302
+
303
+ The project contains a simulated website redesign.
304
+
305
+
306
+
307
+ \### Original selector
308
+
309
+
310
+
311
+ ```text
312
+
313
+ \[data-testid="price"]
314
+
315
+ ```
316
+
317
+
318
+
319
+ \### New selector
320
+
321
+
322
+
323
+ ```text
324
+
325
+ .product-price
326
+
327
+ ```
328
+
329
+
330
+
331
+ When the old selector stops working, EvoScrape detects the failure.
332
+
333
+
334
+
335
+ It discovers candidates such as:
336
+
337
+
338
+
339
+ ```text
340
+
341
+ .product
342
+
343
+ .product-price
344
+
345
+ ```
346
+
347
+
348
+
349
+ The candidate scorer evaluates them.
350
+
351
+
352
+
353
+ Example:
354
+
355
+
356
+
357
+ ```text
358
+
359
+ Candidate:
360
+
361
+ {'tag': 'div',
362
+
363
+  'text': 'โ‚น49,999',
364
+
365
+  'data-testid': None,
366
+
367
+  'id': None,
368
+
369
+  'class': \['product-price']}
370
+
371
+
372
+
373
+ Score: 85
374
+
375
+
376
+
377
+ Reasons:
378
+
379
+ \- exact value match
380
+
381
+ \- price-like value
382
+
383
+ \- price-related class
384
+
385
+ ```
386
+
387
+
388
+
389
+ The system chooses:
390
+
391
+
392
+
393
+ ```text
394
+
395
+ .product-price
396
+
397
+ ```
398
+
399
+
400
+
401
+ It then validates the selector and saves it automatically.
402
+
403
+
404
+
405
+ \## ๐Ÿ“Š Example Output
406
+
407
+
408
+
409
+ ```text
410
+
411
+ ================================
412
+
413
+   EVOSCRAPE AI
414
+
415
+ ================================
416
+
417
+
418
+
419
+ ๐Ÿ”ง Checking scraper health...
420
+
421
+
422
+
423
+ ๐Ÿ”Ž Checking saved selector:
424
+
425
+ \[data-testid="price"]
426
+
427
+
428
+
429
+ โŒ Selector failed.
430
+
431
+ Reason: Selector found no elements
432
+
433
+
434
+
435
+ ๐Ÿ”ง AUTO-HEAL ACTIVATED
436
+
437
+
438
+
439
+ ๐Ÿ”Ž Candidates discovered:
440
+
441
+
442
+
443
+ Candidate:
444
+
445
+ {'tag': 'div', 'text': 'โ‚น49,999',
446
+
447
+  'data-testid': None,
448
+
449
+  'id': None,
450
+
451
+  'class': \['product-price']}
452
+
453
+
454
+
455
+ Score: 85
456
+
457
+
458
+
459
+ ๐Ÿ† BEST REPLACEMENT
460
+
461
+ Element : div
462
+
463
+ Value : โ‚น49,999
464
+
465
+ Selector: .product-price
466
+
467
+ Score : 85
468
+
469
+
470
+
471
+ ๐Ÿงช Validating replacement selector...
472
+
473
+
474
+
475
+ โค๏ธ AUTO-HEAL SUCCESSFUL
476
+
477
+ Old: \[data-testid="price"]
478
+
479
+ New: .product-price
480
+
481
+
482
+
483
+ ๐Ÿ’พ Selector saved!
484
+
485
+ File: config/selectors.json
486
+
487
+
488
+
489
+ ๐Ÿ“Š Healing report saved!
490
+
491
+ File: config/healing\_log.json
492
+
493
+
494
+
495
+ ๐Ÿš€ Starting extraction...
496
+
497
+
498
+
499
+ ================================
500
+
501
+   EVOSCRAPE RESULT
502
+
503
+ ================================
504
+
505
+
506
+
507
+ ๐Ÿ“ฆ Product : Gaming Laptop
508
+
509
+ ๐Ÿ’ฐ Price : โ‚น49,999
510
+
511
+ โญ Rating : 4.5
512
+
513
+
514
+
515
+ ๐Ÿ”Ž Selector : .product-price
516
+
517
+
518
+
519
+ โœ… SCRAPING COMPLETE
520
+
521
+ ```
522
+
523
+
524
+
525
+ \## ๐Ÿ“Š Healing Log
526
+
527
+
528
+
529
+ Every successful healing operation can be recorded in:
530
+
531
+
532
+
533
+ ```text
534
+
535
+ config/healing\_log.json
536
+
537
+ ```
538
+
539
+
540
+
541
+ Example:
542
+
543
+
544
+
545
+ ```json
546
+
547
+ {
548
+
549
+   "field": "price",
550
+
551
+   "old\_selector": "\[data-testid=\\"price\\"]",
552
+
553
+   "new\_selector": ".product-price",
554
+
555
+   "confidence": 0.85,
556
+
557
+   "reasons": \[
558
+
559
+   "exact value match",
560
+
561
+   "price-like value",
562
+
563
+   "price-related class"
564
+
565
+   ],
566
+
567
+   "status": "healed"
568
+
569
+ }
570
+
571
+ ```
572
+
573
+
574
+
575
+
576
+
577
+ \## ๐ŸŽฏ Why EvoScrape?
578
+
579
+
580
+
581
+ Traditional scrapers often depend on fixed selectors.
582
+
583
+
584
+
585
+ For example:
586
+
587
+
588
+
589
+ ```html
590
+
591
+ <span data-testid="price">โ‚น49,999</span>
592
+
593
+ ```
594
+
595
+
596
+
597
+ If a website redesign changes the element to:
598
+
599
+
600
+
601
+ ```html
602
+
603
+ <div class="product-price">โ‚น49,999</div>
604
+
605
+ ```
606
+
607
+
608
+
609
+ the original selector may stop working.
610
+
611
+
612
+
613
+ EvoScrape attempts to recover automatically instead of requiring the developer to manually update the scraper.
614
+
615
+
616
+
617
+ \## ๐Ÿ”ฎ Future Improvements
618
+
619
+
620
+
621
+ Future versions could include:
622
+
623
+
624
+
625
+ \* ๐Ÿค– LLM-powered element reasoning
626
+
627
+ \* ๐Ÿง  More advanced semantic matching
628
+
629
+ \* ๐Ÿ”„ Automatic retries
630
+
631
+ \* ๐Ÿ“„ Multiple-page scraping
632
+
633
+ \* ๐Ÿ“ฆ CSV and JSON exports
634
+
635
+ \* ๐Ÿ–ผ๏ธ Screenshot-based element detection
636
+
637
+ \* ๐ŸŽฏ Multiple-field healing
638
+
639
+ \* ๐ŸŒ Support for more complex websites
640
+
641
+ \* ๐Ÿ“Š Web dashboard for healing history
642
+
643
+ \* ๐Ÿ“ˆ Advanced confidence thresholds
644
+
645
+
646
+
647
+ \## ๐ŸŽ“ Educational Purpose
648
+
649
+
650
+
651
+ EvoScrape is an educational project exploring how AI-assisted systems can make web automation more resilient to website changes.
652
+
653
+
654
+
655
+ The current version uses deterministic scoring and validation rather than relying on an external AI API.
656
+
657
+
658
+
659
+ \## ๐Ÿ“œ License
660
+
661
+
662
+
663
+ This project is intended for educational and experimental purposes.
664
+
665
+
666
+
@@ -0,0 +1,5 @@
1
+ """
2
+ EvoScrape - AI-powered self-healing web scraper.
3
+ """
4
+
5
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: evoscrape
3
+ Version: 0.1.0
4
+ Summary: AI-powered self-healing web scraper
5
+ Requires-Python: >=3.10
@@ -0,0 +1,7 @@
1
+ README.md
2
+ pyproject.toml
3
+ evoscrape/__init__.py
4
+ evoscrape.egg-info/PKG-INFO
5
+ evoscrape.egg-info/SOURCES.txt
6
+ evoscrape.egg-info/dependency_links.txt
7
+ evoscrape.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ evoscrape
@@ -0,0 +1,12 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "evoscrape"
7
+ version = "0.1.0"
8
+ description = "AI-powered self-healing web scraper"
9
+ requires-python = ">=3.10"
10
+
11
+ [tool.setuptools]
12
+ packages = ["evoscrape"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+