Untitled

 avatar
user_3839718
python
7 months ago
760 B
4
Indexable
Never
import requests
from bs4 import BeautifulSoup
import pandas as pd

r = requests.get('https://ef.sakarya.edu.tr/tr/2972/akademik_kadro')

# gallery-content
soup = BeautifulSoup(r.content, 'html.parser')
# div class gallery-content get
galleryContent = soup.find_all('div', class_='gallery-content')
datalist = []


for item in galleryContent:
    data = {"isim": item.find('h5', class_='gallery-title unvanAdSoyad').text,
            "bolum": item.find('p', class_='bolum').text,
            "anabilimdali": item.find('p', class_='anabilimdali').text,
            "link": item.find('a', href=True)['href'],
            "email": item.find('a', href=True).text}
    datalist.append(data)

df = pd.DataFrame(datalist)
df.to_csv('akademik_kadro.csv', index=False)

Leave a Comment