 Kokoma programme ya web crawler oyo esangisi ba posts nionso oyo ewutaka na site internet moko boye.
Tala programme ya pete ya Python web crawler oyo ekoki kosangisa ba posts nionso na site internet na kosalelaka bibliothèque ya Soupe Kitoko: ```python import demands from bs4 import BeautifulSoup def web_crawler(website_url): # Sala demande ya GET na site response = demandes. get(website_url) # Tala soki bosengi elongaki soki response.status_code == 200: # Parser eyano na kosalelaka Soupe kitoko soup = BeautifulSoup(response.text, 'html.parser') # Luka ba posts nionso na site posts = soup.find_all('div', class_='post') # Boucle na poste moko na moko mpe bimisa ba données mpo na index, poste na enumerate(posts, start=1): title = post.find('h2').text content = post.find ('p').text imprimer (f'\nPost {index}:') imprimer (f'Titre: {titre}') imprimer (f'Makambo: {contenu}') else: imprimer (f 'Libunga esalemi tango ya kosala bosenga: {response.status_code}') # Meka mosala ya web_crawler na site internet ya ndakisa soki __name__ == '__main__': website_url = 'https://www.example.com' web_crawler(website_url) ``` Crawler web oyo etindi bosengi ya GET na site internet oyo elakisami mpe na sima esalela Soupe Kitoko mpo na ko parser eyano. Elukaka ba éléments nionso ya `div` na valeur ya attribut `class` ya `post` mpe sima ebimisaka titre ya post mpe contenus na moko na moko. Toyebi ete code oyo ezali kaka ndakisa mpe ekosenga kobongisa yango mpo na kosala na structure spécifique ya site internet. Lisusu, ezali na ntina mingi kotala fichier robots.txt ya site internet liboso ya kosangisa ba données mpo na kosala ete action yango epesami nzela.