Advertisement
SwarupSaha

Subscription Transfer

Sep 3rd, 2016
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var fs = require('fs'),
  2.     childProc = require('child_process'),
  3.     xml2js = require('xml2js');
  4.  
  5. var parser = new xml2js.Parser();
  6. fs.readFile(__dirname + '/subscription_manager.xml', function (err, data) {
  7.     parser.parseString(data, function (err, result) {
  8.         var nodes = result.opml.body[0].outline[0].outline;
  9.  
  10.         nodes.forEach(function (node, index) {
  11.             var url = node['$'].xmlUrl;
  12.             url = url.substring(url.indexOf('=') + 1, url.length);
  13.             var channel = 'https://www.youtube.com/channel/' + url;
  14.            
  15.             if (index == 1) { // Safe Break only remove this when you are ready!
  16.                 childProc.exec('open -a "Google Chrome" ' + channel);
  17.             }
  18.         });
  19.     });
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement