graph TD
A[Start] --> B[Input: Source URL]
B --> C[Check URL Type]
C -->|Amazon| D1[Extract ASIN]
C -->|Etsy| D2[Parse Etsy URL]
D1 --> E1[Call Amazon API]
D2 --> E2[Parse Etsy HTML]
E1 --> F[Extract Data Elements]
E2 --> F
F --> G1[Extract Title]
F --> G2[Extract Bullet Points]
F --> G3[Extract Description]
F --> G4[Extract Main Image URL]
G1 --> H[Validate Data Format]
G2 --> H
G3 --> H
G4 --> H
H -->|Valid| I[Structure Data JSON]
H -->|Invalid| J[Error Handler]
J --> K[Log Error]
K --> L[Retry Extraction]
L --> F
I --> M[Quality Check]
M -->|Pass| N[Output Structured Data]
M -->|Fail| J
N --> O[End]