admin管理员组

文章数量:1323707

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("");
 var text = ArticleExtractor.INSTANCE.getText(url);

document.write(text);

</script>

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

<?php 


$html = file_get_contents("");

?>


<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); 

?>

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.");
 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.");

?>


<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); 

?>

Share Improve this question edited Oct 25, 2012 at 21:31 hippietrail 17k21 gold badges109 silver badges179 bronze badges asked May 3, 2011 at 10:46 user734063user734063 5691 gold badge5 silver badges13 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 14

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).

本文标签: javascriptStuck on BoilerpipeStack Overflow