{"size": 683, "ext": "js", "max_stars_repo_path": "loadpage.js", "max_stars_repo_name": "One2r/FetchM3u8", "max_stars_repo_stars_event_min_datetime": "2016-04-17T08:08:54.000Z", "max_stars_repo_stars_event_max_datetime": "2019-02-13T01:48:00.000Z", "max_issues_repo_path": "loadpage.js", "max_issues_repo_name": "One2r/FetchM3u8", "max_issues_repo_issues_event_min_datetime": "2017-10-11T06:05:39.000Z", "max_issues_repo_issues_event_max_datetime": "2017-10-30T08:30:05.000Z", "max_forks_repo_path": "loadpage.js", "max_forks_repo_name": "One2r/FetchM3u8", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 28.4583333333, "max_line_length": 112, "alphanum_fraction": 0.6500732064}
var page = require('webpage').create(),
  system = require('system'),
  address;

if (system.args.length === 1) {
  console.log('Usage: loadpage.js <some URL>');
  phantom.exit();
}

address = system.args[1];
page.settings.userAgent = 'Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html）)'
page.open(address, function(status) {
  if (status !== 'success') {
    console.log('FAIL to load the address');
  } else {
    m3u8 = page.evaluate(function() {
      var flashvars =  document.getElementsByTagName("embed")[0].getAttribute("flashvars");
      return unescape(flashvars.substr(5))
    });
    console.log("url:"+m3u8);
  }
  phantom.exit();
});
