From e059ad0606b0327186b3fd2a3195f3b0c2d6c8ef Mon Sep 17 00:00:00 2001 From: Jeremy Brown Date: Thu, 9 Sep 2021 15:50:23 -0500 Subject: [PATCH] Escape Ampersand and carrots in channel.display-name --- zap2it-GuideScrape.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zap2it-GuideScrape.py b/zap2it-GuideScrape.py index f620817..8e63c6a 100644 --- a/zap2it-GuideScrape.py +++ b/zap2it-GuideScrape.py @@ -17,6 +17,7 @@ import sys, getopt #Libraries for historical copies import datetime, os +from xml.sax.saxutils import escape def sanitizeData(data): #https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents @@ -33,7 +34,7 @@ def buildXMLChannel(channel): xml = xml + "\t\t" + '' + html.unescape(channel["channelNo"] + " " + channel["callSign"]) + '' + "\n" xml = xml + "\t\t" + '' + html.unescape(channel["channelNo"]) + '' + "\n" xml = xml + "\t\t" + '' + html.unescape(channel["callSign"]) + '' + "\n" - xml = xml + "\t\t" + '' + html.unescape(channel["affiliateName"].title()) + '' + "\n" + xml = xml + "\t\t" + '' + escape(html.unescape(channel["affiliateName"].title())) + '' + "\n" xml = xml + "\t\t" + '' + "\n" xml = xml + "\t" + '' + "\n" return xml @@ -59,7 +60,7 @@ def buildXMLProgram(event,channelId): xml = xml + "\t\t" + '' + "\n" xml = xml + "\t\t" + 'https://tvlistings.zap2it.com//overview.html?programSeriesId=' + event["seriesId"] + '&tmsId=' + event["program"]["id"] + '' + "\n" - + try: #if "season" in event: if event["program"]["season"] is not None: @@ -72,7 +73,7 @@ def buildXMLProgram(event,channelId): for category in event["filter"]: xml = xml + "\t\t" + '' + html.unescape(category.replace('filter-','')) + '' + "\n" - + #print season + "." + episode if ((int(season) != 0) and (int(episode) != 0)): xml = xml + "\t\t" + 'Series' + "\n" @@ -100,7 +101,7 @@ def buildXMLProgram(event,channelId): xml = xml + "\t\t" + '' + "\n" xml = xml + "\t\t\t" + '' + event["rating"] + '' + "\n" xml = xml + "\t\t" + '' + "\n" - + xml = xml + "\t" + ''+"\n" return xml @@ -187,7 +188,7 @@ def buildXMLDate(inputDateString): 'lineupId':'DFLTE', 'timespan':3, 'headendId': 'lineupId', - 'country': Config.get("prefs","country"), + 'country': Config.get("prefs","country"), 'device': '-', 'postalCode': Config.get("prefs","zipCode"), 'isOverride': "true",