Arkadaşlar aşağıdaki kod none döndürüyor nedenini bir türlü anlayamadım yardımcı olabilir misiniz ?
import time
import requests
from bs4 import BeautifulSoup
keyword = input("Anahtar kelime:")
def get_google_maps_results(keyword):
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
headers = {
"User-Agent": user_agent
}
"Gets results from Google Maps for the given keyword."
# Create a URL for the Google Maps API.
url = "https://www.google.com/maps/search/?q=" + keyword
# Make a request to the Google Maps API.
response = requests.get(url, headers=headers)
# Check if the request was successful.
if response.status_code == 200:
# Get the results from the response.
print("Bağlantı Başarılı")
# HTML'yi işleyici
soup = BeautifulSoup(response.content, "lxml")
print("Sayfa kaynağı ayrıştırılıyor..")
print(soup)
# Bağlantıları bul
links = soup.find_all("div", class_="bfdHYd Ppzolf OFBs3e")
print("URL kaynakları toplanıyor..")
print(links)
# Bağlantıların href'lerini yazdır
for link in links:
print(link["aria-label"])
else:
print("Bağlantı Başarısız")
get_google_maps_results(keyword)