Guest User

Untitled

a guest
Nov 24th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
  2. 1: node::Abort() [node]
  3. 2: 0x10d3f9c [node]
  4. 3: v8::Utils::ReportApiFailure(char const*, char const*) [node]
  5. 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
  6. 5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
  7. 6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
  8. 7: 0x292aec062bf
  9. Aborted
  10.  
  11. var express = require('express');
  12. var path = require('path');
  13. var request = require('request');
  14. var cheerio = require('cheerio');
  15. var fs = require('fs');
  16. var app = express();
  17. var count = 1;
  18. var url;
  19.  
  20. while(count != 10){
  21. url = "http://www.ratemyprofessors.com/ShowRatings.jsp?tid=" + count;
  22. request(url, function(err, resp, body){
  23. var $ = cheerio.load(body);
  24. if($('.error').text().substring(0, 14) == "Page Not Found"){
  25. console.log("hello");
  26. count++;
  27. return;
  28. }else{
  29. console.log($('.error').text().substring(0, 14) );
  30. var pfname = $('.pfname');
  31. var plname = $('.plname');
  32. var professorName = pfname.text().replace(/s/g, '') + " " +plname.text().replace(/s/g, '');
  33. console.log(professorName);
  34. console.log(url);
  35. count++;
  36. }
  37. return;
  38. })
  39. }
  40.  
  41. app.listen(3000, function(){
  42. console.log("server is now listening");
  43. })
Add Comment
Please, Sign In to add comment