Seçkin Üye
Href değerlerini yazdıramıyorum , nasıl bir düzeltme yapmam gerekiyor . Yapay zeka araçlarına sordum .
Kod:
from bs4 import BeautifulSoup
import requests
def data():
n = 5
dosya_adı = "datas.txt"
with open(dosya_adı, "w") as dosya:
while n < 45:
url = f"https://www.vesselfinder.com/vessels?page={n}&minLength=100&maxLength=150&type=3&sort=2&dir=2"
dosya.write(url + "\n")
n += 1
def process():
dosya_adı = "datas.txt"
with open(dosya_adı, "r") as dosya:
satirlar = dosya.readlines()
for url in satirlar:
response = requests.get(url.strip())
soup = BeautifulSoup(response.content, "html.parser")
for ship in soup.find_all(class_="ship-link"):
print(ship.get('href'))
data()
process()