开发者

Stuck on Boilerpipe

开发者 https://www.devze.com 2023-03-02 17:18 出处:网络
Fairly excited about this utility, but running into some issues with implementation. Installed it but getting no result with execution of HTML file on server. Syntax error on the URL code.

Fairly excited about this utility, but running into some issues with implementation. Installed it but getting no result with execution of HTML file on server. Syntax error on the URL code.

<script LANGUAGE="JavaScript" SRC="boilerpipe-1.1.0.jar">
</script>

<script type="text/javascript">


 URL url = new URL("http://www.mywebsite.com");
 var text = ArticleExtractor.INSTANCE.getText(url);

document.write(text);

</script>

EDIT =====> This code appears to have worked.

<?php 


$html = file_get_contents("http://www.google.com");

?>


<script language="JavaScript" src="bo开发者_运维问答ilerpipe-1.1.0.jar"></script>


<script language="javascript" type="text/javascript">

  var sStr = "<?php echo $html?>";

  var text = ArticleExtractor.INSTANCE.getText(sStr);

document.write(text); 

?>


Boilerpipe is a Java library, not a JavaScript library. The relationship between the two languages is only slightly deeper then the relationship between a Car and a Carpet.

If you want to use Boilerpipe within a webpage then you'll need to either write a Java Applet that exposes the API to JavaScript, or write a web service that exposes it over HTTP (and then access it using Ajax).

0

精彩评论

暂无评论...
验证码 换一张
取 消