ardozcnn
Femtopat
- Katılım
- 1 Şubat 2023
- Mesajlar
- 6
Daha fazla
- Cinsiyet
- Erkek
Python:
@client.command()
async def uçuş(ctx, city1: str, city2: str, date: str):
city1 = city1.replace(" ", "+")
city2 = city2.replace(" ", "+")
url = f"https://www.kayak.com/flights/{city1}-{city2}/{date}?sort=bestflight_a"
sayfa = requests.get(url)
html_sayfa = BeautifulSoup(sayfa.content, "html.parser")
flight = html_sayfa.find("div", class_="top").getText()
if flight:
flight = flight.getText()
embed = discord.Embed(title = "UÇUŞ" , description = f"```{flight}```", color = discord.Colour.red())
await ctx.send(embed=embed)
else:
await ctx.send("Hata var.")
Bu kod kayak.com sitesinden Discord'a yazılana göre şehre göre ve tarihe göre arama yapıyor. Ben buradan en ucuz uçuşu bulmaya çalışıyorum. Bir türlü.
Python:
flight = html_sayfa.find("div", class_="top").getText()
"Class_="nin nerede olduğunu bulamıyorum sitede ve en ucuz uçuşu bulamıyor.