Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made changes to /schedule path #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,31 @@ def schedule():
source = requests.get(link).text
page = BeautifulSoup(source, "lxml")
page = page.find_all("div",class_="cb-col-100 cb-col")
first = page[0].find_all("div",class_="cb-col-100 cb-col")
matches = []
for i in range(len(first)):
matches.append(first[i].text)


return jsonify(matches)
matches_all = []

for container in page:
match_details = container.find_all('div', class_='cb-ovr-flo cb-col-50 cb-col cb-mtchs-dy-vnu cb-adjst-lst')

for match in match_details:
matches_one = {}
title = match.find('a')['title']
date_div = container.find('div', class_='cb-lv-grn-strip text-bold')
if date_div:
date = date_div.text.strip()
venue = match.find('div', class_='cb-font-12 text-gray cb-ovr-flo').text.strip()
time_div = match.find_next('div', class_='cb-col-50 cb-col cb-mtchs-dy-tm cb-adjst-lst')
if time_div:
time = time_div.find('div', class_='cb-font-12 text-gray').text.strip()
else:
time = "Time not available"

matches_one['match'] = title
matches_one['date'] = date
matches_one['venue'] = venue
matches_one['time'] = time
matches_all.append(matches_one)

return jsonify(matches_all)


@app.route('/live')
Expand Down