import requests
from bs4 import BeautifulSoup as bs
import pandas
url = 'https://freshman.tw/cross/'
request_headers = {
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) ' \
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
}
r = requests.get(url, headers=request_headers)
soup = bs(r.text, 'lxml')
schools = []
for t in soup.select('.card.card-block'):
school_str = t.select('a')[0].text
no = school_str.split(' ')[0]
school = school_str.split(' ')[1]
dic = {no:school}
schools.append(dic)
df = pandas.DataFrame(schools)
df