title: Extract javascript information from url with python
body: <p>I have a URL that links to a javascript file, for example <code>http://something.com/../x.js</code>. I need to extract a variable from <code>x.js</code> </p>
  
  <p>Is it possible to do this using python? 
  At the moment I am using <code>urllib2.urlopen()</code> but when I use <code>.read()</code> I get this lovely mess:</p>
  
  <pre><code>U�(��%y�d�&lt;�!���P��&amp;Y��iX���O�������&lt;Xy�CH{]^7e� �K�\�͌h��,U(9\ni�A ��2dp}�9���t�&lt;M�M,u�N��h�bʄ�uV�\��0�A1��Q�.)�A��XNc��$"SkD�y����5�)�B�t9�):�^6��`(���d��hH=9D5wwK'�E�j%�]U~��0U�~ʻ��)�pj��aA�?;n�px`�r�/8&lt;?;�t��z�{��n��W
  �s�������h8����i�߸#}���}&amp;�M�K�y��h�z�6,�Xc��!:'D|�s��,�g$�Y��H�T^#`r����f����tB��7��X�%�.X\��M9V[Z�Yl�LZ[ZM�F���`D�=ޘ5�A�0�){Ce�L*�k���������5����"�A��Y�}���t��X�(�O�̓�[�{���T�V��?:�s�i���ڶ�8m��6b��d$��j}��u�D&amp;RL�[0&gt;~x�jچ7�
  </code></pre>
  
  <p>When I look in the dev tools to see the DOM, the only thing in the body is a string wrapped in  tags. In the regular view that string is a json element. </p>