I am using the YouTube API and I'm using Python urllib2.urlopen() to send a GET request. Then I pass the result to Javascript. (I'm using Django)
So, something like this:
result = urllib2.urlopen('https://gdata.youtube.com/feeds/api/videos?'+query+'&max-results=1&alt=json')
I'm using jQuery to parse the JSON formatted response, however some YouTube videos/descriptions have double quotes and this breaks the parseJSON() function.
Any help would be highly appreciated.
the error was on my end (obviously) ..the error started with the fact that I didn't realize Django automatically escapes HTML characters due to security, and I hacked my own way of ignoring special HTML chars like & quot; which ended up malforming the json.
the easy fix (in case anybody uses django and ever runs into this problem) to escape special HTML chars is with {{ var|safe }} ..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With