内のコンテンツのため、出力するHTML文書をjsbin解析する私はhttps://jsbin.com/wanegavisa/edit?html,js,consoleここjsbinを持っていると私は、出力のhtml https://output.jsbin.com/wanegavisaをダウンロードして、jsbinエディタでjavascript
タブ内のコンテンツを解析するためにnodejsを使用しようとしています。私はcheerioのようなdomパーサーを使用して、body
の中に最初の<script>
タグを取得しようとしていました。私はちょうど人が身体に直接スクリプトタグを追加できることを見た。私はこのような文書はウェイのJavaScript 'フィールド
console.log('hi')
を含む文字列を取得することができます解析することができ、私はこのURL https://static.jsbin.com/js/render/edit.js
に等しいのsrcとスクリプトから兄弟のスクリプトを選択することができますどのように
。しかし、そのURLが変わったら、私は運が尽きます。
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<meta charset="utf-8">
<!--
Created using JS Bin
http://jsbin.com
Copyright (c) 2016 by anonymous (http://jsbin.com/wanegavisa/2/edit)
Released under the MIT license: http://jsbin.mit-license.org
-->
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script>console.log('meow')</script>
<script>
console.log('hi')
</script>
<script src="https://static.jsbin.com/js/render/edit.js?3.35.12"></script>
<script>jsbinShowEdit && jsbinShowEdit({"static":"https://static.jsbin.com","root":"https://jsbin.com"});</script>
<script src="https://static.jsbin.com/js/vendor/eventsource.js?3.35.12"></script>
<script src="https://static.jsbin.com/js/spike.js?3.35.12"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1656750-34', 'jsbin.com');
ga('require', 'linkid', 'linkid.js');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>
代わりhttps://jsbin.com/api/wanegavisa APIを使用 –