daniel-widrick / zap2it-GuideScraping

MIT License
61 stars 22 forks source link

Lack of exception handling #27

Closed ahajalie closed 1 year ago

ahajalie commented 1 year ago

I am frequently getting errors similar to this:

thumnailEl = self.CreateElementWithData("thumnail","http://zap2it.tmsimg.com/assets/" + event["thumbnail"] + ".jpg")
TypeError: can only concatenate str (not "NoneType") to str

I am not sure exactly why sometimes the object is empty, but it would probably be best to handle the exception in a way that does not cause a total failure and results in a guide still being generated, even if incomplete.

daniel-widrick commented 1 year ago

Seems that a sanity check was eliminated as part of the rewrite from string concatenation to using minidom to create the XML. I have re-added the "None" check for event["thumbnail"] in d1d77624aba93ffeec9aed0f50fb99f057b0e0a2 .

New behavior will omit the "thumbnail" and "icon"tags if no event["thumbnail"] is found in the json result.

Thank you for the report!