How do I clear an AJAX site?

In the past, I've used the urllib2 library to get the sources from websites. However, I noticed that for a recent website I tried to play with, I cannot find the information I need in the source code.

http://www.wgci.com/playlist is the site I was looking at and want to get the most recent song and playlist of recent songs. I really want to copy and paste the visible, displayable text into a website and put it on a string. Alternatively, being able to access the element that stores these values ​​in clear text and retrieve them using urllib2 will usually be nice. Is there a way to do one of these things?

Thank you.

+3


source to share


1 answer


The website you want to remove uses ajax calls to populate data pages. You have 2 ways to opt out of data:

  • Use a non-browser browser that supports javascript (like ZombieJS) and also dumps the generated output, but this one is tricky and overkill
  • Understand how their API works and call it directly, which is much easier.


Use Chrome dev tools (network tab) to see calls while browsing your website.

For example, a list of last played songs for a given stream is available in JSON at http://www.wgci.com/services/now_playing.html?streamId=841&limit=12

+3


source







All Articles