From 71b4e37d2d9f48f43972c30b720276237a804c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20P=C5=82azie=C5=84ski?= Date: Mon, 7 Mar 2016 00:00:55 +0100 Subject: [PATCH] accepting no valid xml in response as missing subtitles --- napi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/napi b/napi index fc4724a..b7b0654 100755 --- a/napi +++ b/napi @@ -55,7 +55,9 @@ for movie_filename in args: response = urllib.urlopen(base_url, request_data) response_data = response.read() response_xml = XML(response_data) - if response_xml.find('status').text != 'success': + + response_status = response_xml.find('status') + if response_status is None or response_status.text != 'success': print "%s: No subtitles found" % (movie_filename,) continue