1
0
Fork 0
mirror of https://github.com/SocksPls/hltv-api synced 2025-05-01 07:53:07 +00:00

Merge pull request #9 from zGrav/master

fix(main): small fix regarding results w/ featured events
This commit is contained in:
Socks 2017-12-02 18:07:00 +00:00 committed by GitHub
commit b92e608268
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
import re
import requests
import datetime
from bs4 import BeautifulSoup
from python_utils import converters
@ -170,7 +171,7 @@ def get_results():
results_list = []
pastresults = results.find("div", {"class": "results-holder"}).find("div", {"class": "results-all"}).find_all("div", {"class": "results-sublist"})
pastresults = results.find_all("div", {"class": "results-holder"})
for result in pastresults:
resultDiv = result.find_all("div", {"class": "result-con"})
@ -180,7 +181,11 @@ def get_results():
resultObj = {}
resultObj['date'] = result.find("span", {"class": "standard-headline"}).text.encode('utf8')
if (res.parent.find("span", {"class": "standard-headline"})):
resultObj['date'] = res.parent.find("span", {"class": "standard-headline"}).text.encode('utf8')
else:
dt = datetime.date.today()
resultObj['date'] = str(dt.day) + '/' + str(dt.month) + '/' + str(dt.year)
if (res.find("td", {"class": "placeholder-text-cell"})):
resultObj['event'] = res.find("td", {"class": "placeholder-text-cell"}).text.encode('utf8')