import requests | |
from bs4 import BeautifulSoup | |
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() |