Version simplifiée & professionnelle — contenu condensé pour implémentation rapide.
Coupler un script Playwright à ChatGPT pour automatiser :
Chaque site peut disposer d'un profil dédié, stocké dans le programme Python ou fichier config, incluant :
# Profil "GallerySite"
Respond with JSON format:
{
"profile": "GallerySite",
"action": "SCRAPE_IMAGES",
"target_url": "https://example.com/gallery",
"selectors": {"image": "img.thumb", "title": ".caption"},
"output": "data/images_gallery.json"
}
# Profil "PinterestBoard" <action type="LOGIN" username_id="#email" password_id="#pass" submit="#loginBtn" profile="PinterestBoard" /> <action type="SCRAPE_BOARD" board_id="board-12345" elements=".pin img" meta=".description" output="data/pins.json" profile="PinterestBoard" />
# Profil "ComplexScraper"
Respond in JSON:
{
"profile": "ComplexScraper",
"action": "CLICK_AND_EXTRACT",
"target": "button#loadMore",
"metadata": {
"url_map": {"img1":"https://site.com/img1.jpg", "img2":"https://site.com/img2.jpg"},
"categories": ["nature", "tech", "art"]
},
"repeat_until_end": true
}
Chaque profil est indépendant et peut être sélectionné dans le programme principal, permettant de réutiliser la même logique de parsing et exécution Playwright tout en adaptant les sélecteurs et actions au site cible.
Nom du projet : ChatPilot-Playwright
ChatPilot-Playwright/
├── README.md
├── requirements.txt
├── config/
│ ├── prompt_maitre_gallery.txt
│ ├── prompt_maitre_pinterest.txt
│ ├── prompt_maitre_complex.txt
│ └── settings.yaml
├── src/
│ ├── main.py
│ ├── ai/
│ │ ├── parser.py
│ │ ├── protocol.py
│ │ └── state.py
│ ├── browser/
│ │ ├── client.py
│ │ ├── actions.py
│ │ └── monitor.py
│ └── utils/
│ ├── logger.py
│ └── tools.py
├── data/
│ ├── cache/
│ └── outputs/
└── tests/
├── test_parser.py
└── test_actions.py