Advertisement
zero50x

unibug

Sep 18th, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var fs = require('fs');
  2. var webPage = require('webpage');
  3. var page = webPage.create();
  4.  
  5. var useragent = [];
  6. useragent.push('Opera/9.80 (X11; Linux x86_64; U; fr) Presto/2.9.168 Version/11.50');
  7. useragent.push('Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25');
  8. useragent.push('Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.02');
  9.  
  10. page.settings = {
  11.   // Случайный выбор userAgent
  12.   userAgent: useragent[Math.floor(Math.random() * useragent.length)]
  13. }
  14.  
  15. page.open('https://devaka.ru/', function(status) {
  16.   console.log('Status: ' + status);
  17.   // Do other things here...
  18.   if (status === 'success') {
  19.     console.log('Page loaded');
  20.  
  21.     //выведем в консоль
  22.     //console.log(page.content);
  23.  
  24.     html = page.content;
  25.     fs.write('/var/www/wik/data/www/bestscare.ru/art.html', html, "wba");
  26.  
  27.     phantom.exit();
  28.   }
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement