I am trying to extract JavaScript source code in a website such as https://stackoverflow.com/
First method, I tried
document.scripts
DOM API function. I got an array of HTMLElement Object. I also trieddocument.scripts[0].text
, but it can not be printed.Second method, I used Sources panel in of Chrome DevTools
. But this method can not extract JS source code automatically.
Third method, building a web scraper to extract
<script>
tag in website. However, this method can not extract the dynamic JS source code which can include by jquery load script, for example.
So, Are there any method to extract JavaScript source code in a website?