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.
- evoscrape-0.1.0/PKG-INFO +5 -0
- evoscrape-0.1.0/README.md +666 -0
- evoscrape-0.1.0/evoscrape/__init__.py +5 -0
- evoscrape-0.1.0/evoscrape.egg-info/PKG-INFO +5 -0
- evoscrape-0.1.0/evoscrape.egg-info/SOURCES.txt +7 -0
- evoscrape-0.1.0/evoscrape.egg-info/dependency_links.txt +1 -0
- evoscrape-0.1.0/evoscrape.egg-info/top_level.txt +1 -0
- evoscrape-0.1.0/pyproject.toml +12 -0
- evoscrape-0.1.0/setup.cfg +4 -0
evoscrape-0.1.0/PKG-INFO
ADDED
|
@@ -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 @@
|
|
|
1
|
+
|
|
@@ -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"]
|