Kokoma web crawler mpo na kobimisa ba email na site internet.
Crawler web ezali programme logiciel oyo etambolaka na web na ndenge ya système mpe automatiquement, ezuaka ba informations na ba sites internet. Awa, tokokoma rastreur web na Python mpo na kobimisa ba emails na site internet. Ya liboso, ekosenga to importer ba bibliothèques oyo esengeli pona rastreur web na biso. ```python import requests from bs4 import BeautifulSoup import re ``` Bibliothèque ya `requests` esalelamaka mpo na kotinda bosengi ya HTTP na site internet mpe kozwa makambo na yango. `BeautifulSoup` esalelamaka pona ko parser HTML oyo ezuami na site internet, alors que bibliothèque `re` esalelamaka pona kosalela ba expressions régulières pona matching ya modèle. ```python url = 'https://www.example.com' # Site internet oyo olingi ko rastrer page = requests.get(url) # Tinda demande ya GET pona kozua contenus ya site soup = BeautifulSoup(page.content, 'html.parser') # Parser contenus ya HTML ``` Sikoyo tosalelaka expression régulière pona kozua ba adresses email na contenus ya site internet. ```modèle_ya email ya python = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[AZ|az]{2,}\[A-Za-z0-9.-]+\.[AZ|az]{2,}\ b' emails = re.findall(email_pattern, str(soup)) # Luka ba email nionso na kosalelaka expression régulière # Imprimer ba emails extraits pona email na ba emails: print(email) ``` Crawler web oyo eko tinda demande HTTP na... site Internet oyo elakisami, ezwa mpe etalelaka makambo na yango ya HTML, mpe na nsima ebimisaka baadrɛsi nyonso ya email oyo ezali na lokasa yango. Kasi, kobosana te ete ba site internet nionso te epesaka nzela na kosala rastrement, mpe esengeli otala fichier na bango `robots.txt` yambo ya kosala rastrement na site internet.