igal / app.py
SamiKoen's picture
Update app.py
ac1a65c
raw
history blame contribute delete
No virus
692 Bytes
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()