문제

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="boilerpipe-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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top