import requests
from bs4 import BeautifulSoup
# 1. URL'den .txt içeriğini çek
url = "https://orneksite.com/"
response = requests.get(url)
response.encoding = 'utf-8' # Gerekirse değiştirebilirsin
html = response.text
# 2. BeautifulSoup ile parse et
soup = BeautifulSoup(html, "html.parser")
# 3. Rakamları buraya toplayacağız
code_digits = []
# 4. İlgili tag'leri kontrol et
for tag in soup.find_all(['b', 'span', 'strong']):
style = tag.get('style', '').lower()
if 'display:none' not in style and 'font-size' in style:
text = tag.get_text(strip=True)
digits = ''.join(filter(str.isdigit, text))
code_digits.append(digits)
# 5. Sonucu birleştir
final_code = ''.join(code_digits)
print("Çıkarılan Kod:", final_code)