Skip to content

Commit

Permalink
parse response as unicode.
Browse files Browse the repository at this point in the history
  • Loading branch information
hako committed Jun 23, 2016
1 parent eda362d commit 061f638
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions bbcli/bbcapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,13 @@ def parse_ticker_data(self, ticker_data):
return tickers

response = data["html"]
htmlData = minidom.parseString(response)
htmlData = minidom.parseString(response.encode('utf-8'))
elements = htmlData.getElementsByTagName("div")

# Not yet tested to handle multiple breaking news alerts.

# Heading
headline = elements[0].getElementsByTagName("p")[0].firstChild.nodeValue.replace("\n","")
# News Link as in /news/
url = elements[0].getElementsByTagName("a")[0].getAttribute('href')

url = elements[0].getElementsByTagName("a")[0].getAttribute('href')
ticker = Ticker(headline, "BREAKING NEWS", "true", BBC_URL + url)
tickers.append(ticker)
return tickers
Expand Down

0 comments on commit 061f638

Please sign in to comment.