1

I'm currently using Beautiful Soup to parse through the HTML of a webpage. However, I would also like to recursively parse through any .js files on the webpage as well. My goal is to look for certain URLs embedded in either the HTML or javascript of a website. I can do it with the base HTML page, but going into the javascript files is stumping me. Any help?

user2132167
  • 151
  • 2
  • 13

1 Answers1

0

Follow the steps outlined in the accepted answer to this StackOverflow question. You can then make a request for the resource using for example, the excellent requests library:

import requests

r = requests.get("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")

You can then search r.text using regex to find any links you are looking for.

If you still need to parse the javascript then the most recent answer to this StackOverflow question recommends slimit once you have the javascript.

Community
  • 1
  • 1
br3w5
  • 4,403
  • 5
  • 33
  • 42