<commit_before>var express = require('express');
var spotify = require('../lib/spotify');
var rdio = require('../lib/rdio');
var router = express.Router();

router.post('/', function(req, res, next) {
  var url = req.param('url');
  var shortCode;

  console.log(url);

  if (url && !!url.match('rd.io')) {
    shortCode = url.split('/')[4];
    rdio.getTrackName(shortCode, function(err, name) {
      if (err) {
        console.log(err);
        return next();
      }
      spotify.getTrackUrl(name, function(err, url) {
        if (err) {
          console.log(err);
          return next();
        }
        res.send({url: url});
      });
    });
  } else if (url && !!url.match('spotify')) {
    shortCode = url.split('/')[4];
    spotify.getTrackName(shortCode, function(err, name){
      if (err) {
        console.log(err);
        return next();
      }
      rdio.getTrackUrl(name, function(err, url) {
        if (err) {
          console.log(err);
          return next();
        }
        res.send({url: url});
      });
    });
  } else {
    res.send({url: ''});<commit_msg>conols<commit_after>var express = require('express');
var spotify = require('../lib/spotify');
var rdio = require('../lib/rdio');
var router = express.Router();

router.post('/', function(req, res, next) {
  var url = req.param('url');
  var shortCode;

  console.log(url);

  if (url && !!url.match('rd.io')) {
    shortCode = url.split('/')[4];
    console.log(shortCode);
    rdio.getTrackName(shortCode, function(err, name) {
      if (err) {
        console.log(err);
        console.log(name);
        return next();
      }
      console.log(name);
      spotify.getTrackUrl(name, function(err, url) {
        if (err) {
          console.log(err);
          return next();
        }
        res.send({url: url});
      });
    });
  } else if (url && !!url.match('spotify')) {
    shortCode = url.split('/')[4];
    spotify.getTrackName(shortCode, function(err, name){
      if (err) {
        console.log(err);
        return next();
      }
      rdio.getTrackUrl(name, function(err, url) {
        if (err) {
          console.log(err);
          return next();
        }
        res.send({url: url});
      });
    });
  } else {
    res.send({url: ''});
{'fraction_non_alphanumeric': 0.19300575475874282, 'fraction_numerical': 0.0017706949977866313, 'mean_word_length': 2.178621659634318, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1159771', 'n_tokens_mistral': 759, 'n_tokens_neox': 748, 'n_words': 145}