File size: 692 Bytes
ed48d64
ac1a65c
 
ed48d64
f7ad402
 
 
 
452c249
f7ad402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
import BeautifulSoup
from bs4 

def get_alatin_titles():
    # Web sitesinden içerik çekme
    url = "https://www.alatin.com.tr/"
    response = requests.get(url)
    
    # Eğer başarılı bir cevap alındıysa
    if response.status_code == 200:
        soup = BeautifulSoup(response.content, 'html.parser')
        
        # Başlıkları çekme (Bu seçici, site yapısına bağlı olarak değişebilir)
        titles = soup.find_all('h2')  # Örnek olarak h2 etiketlerini çekiyoruz
        
        for title in titles:
            print(title.text)

    else:
        print("Web sitesine erişimde bir sorun oluştu.")

# Fonksiyonu çağırma
get_alatin_titles()