Commit Graph

99 Commits

Author SHA1 Message Date
paxt82 a9c92b850a Upload files to 'paxt002'
const expect = require('chai').expect;
const alltomp3 = require('..');
const _ = require('lodash');

function testTracks(tracks, artistName) {
  let queries = [];
  _.forEach(tracks, t => {
    t.song.artistName = artistName;
    let q = alltomp3.findVideoForSong(t.song).then(v => {
      if (t.videos.indexOf(v[0].url) === -1) {
        console.log(t.song.title, v);
      }
      expect(t.videos).to.include(v[0].url);
    });
    queries.push(q);
  });

  return Promise.all(queries);
}

describe('findVideo', function() {
  it('should find YouTube videos for Broken Back by Broken Back', function () {
    this.timeout(20000);
    let artistName = "Broken Back";
    let tracks = [
      {
        song: {
          title: "Excuses",
          duration: 224
        },
        videos: ['https://www.youtube.com/watch?v=aBp7s6BpmrM', 'https://www.youtube.com/watch?v=Ogsfvvwu-wU', 'https://www.youtube.com/watch?v=upUWTD6x3dw']
      },
      {
        song: {
          title: "Halcyon Birds (Radio Edit)",
          duration: 197
        },
        videos: ['https://www.youtube.com/watch?v=xWlXEGIol9E', 'https://www.youtube.com/watch?v=EGSqjTixIyk', 'https://www.youtube.com/watch?v=gzZ43IEJ8S0', 'https://www.youtube.com/watch?v=2Ggu0m0a8WA', 'https://www.youtube.com/watch?v=5eS1WxW4GM4']
      },
      {
        song: {
          title: "Better Run",
          duration: 176
        },
        videos: ['https://www.youtube.com/watch?v=oEugd8BV_Bs', 'https://www.youtube.com/watch?v=5QP8K42-wA8'],
      },
      {
        song: {
          title: "Happiest Man on Earth (Radio Edit)",
          duration: 183
        },
        videos: ['https://www.youtube.com/watch?v=j01T8N7wVK0', 'https://www.youtube.com/watch?v=TqpM_0_H6Qc'],
      },
      {
        song: {
          title: "Got to Go",
          duration: 218
        },
        videos: ['https://www.youtube.com/watch?v=A2iBEZBxT3s', 'https://www.youtube.com/watch?v=MXABmCs5Fkc']
      },
      // This last one is currently too hard
      // {
      //     title: "Young Souls (Album Edit) - Broken Back",
      //     videos: ['https://www.youtube.com/watch?v=LT9kwbunzWc']
      // }
    ];

    return testTracks(tracks, artistName);
  });

  it('should find YouTube videos for Night Visions by Imagine Dragons', function () {
    this.timeout(20000);
    let artistName = "Imagine Dragons";

    let tracks = [
      {
        "song": {
          "title": "Radioactive",
          "duration": 186
        },
        "videos": ['https://www.youtube.com/watch?v=ktvTqknDobU', 'https://www.youtube.com/watch?v=iO_WxYC34eM', 'https://www.youtube.com/watch?v=Thbsg9i2mZ0', 'https://www.youtube.com/watch?v=y_8Mgn30xRU']
      },
      {
        "song": {
          "title": "Tiptoe",
          "duration": 194
        },
        "videos": ['https://www.youtube.com/watch?v=ajjj4pLnjz8', 'https://www.youtube.com/watch?v=UB96k1arlTk', 'https://www.youtube.com/watch?v=211bk6ctXM4', 'https://www.youtube.com/watch?v=zmKv2Aok1Mw']
      },
      {
        "song": {
          "title": "It's Time",
          "duration": 240
        },
        "videos": ['https://www.youtube.com/watch?v=sENM2wA_FTg', 'https://www.youtube.com/watch?v=IOatp-OCw3E', 'https://www.youtube.com/watch?v=qFqMy0ewYFQ']
      },
      {
        "song": {
          "title": "Demons",
          "duration": 177
        },
        "videos": ['https://www.youtube.com/watch?v=mWRsgZuwf_8', 'https://www.youtube.com/watch?v=GFQYaoiIFh8', 'https://www.youtube.com/watch?v=LqI78S14Wgg', 'https://www.youtube.com/watch?v=lxUXvOUKM_Q']
      },
      {
        "song": {
          "title": "On Top Of The World",
          "duration": 192
        },
        "videos": ['https://www.youtube.com/watch?v=w5tWYmIOWGk', 'https://www.youtube.com/watch?v=g8PrTzLaLHc', 'https://www.youtube.com/watch?v=Nwvil057g-g', 'https://www.youtube.com/watch?v=e74VMNgARvY']
      },
      {
        "song": {
          "title": "Amsterdam",
          "duration": 241
        },
        "videos": ['https://www.youtube.com/watch?v=TKtPXO5iEnA', 'https://www.youtube.com/watch?v=s6Nc4qEI3k4', 'https://www.youtube.com/watch?v=dboQYGddEC8', 'https://www.youtube.com/watch?v=j-tfNaBcyes']
      },
      {
        "song": {
          "title": "Hear Me",
          "duration": 235
        },
        "videos": ['https://www.youtube.com/watch?v=1Yr683VLxes', 'https://www.youtube.com/watch?v=EkB2eJfF3W8', 'https://www.youtube.com/watch?v=u0Q3r4ywA34']
      },
      {
        "song": {
          "title": "Every Night",
          "duration": 217
        },
        "videos": ['https://www.youtube.com/watch?v=6RVxzeBiBJU', 'https://www.youtube.com/watch?v=kuijhOvKyYg', 'https://www.youtube.com/watch?v=f6CQ3ATP_6Y', 'https://www.youtube.com/watch?v=k4ESylzBW4M']
      },
      {
        "song": {
          "title": "Bleeding Out",
          "duration": 223
        },
        "videos": ['https://www.youtube.com/watch?v=jNFgynmVmx0', 'https://www.youtube.com/watch?v=gJEoxeW7JvQ', 'https://www.youtube.com/watch?v=Hq6kn87NpKw', 'https://www.youtube.com/watch?v=Tyjt1Ff4m7k']
      },
      {
        "song": {
          "title": "Underdog",
          "duration": 209
        },
        "videos": ['https://www.youtube.com/watch?v=JCUV43T7HZ0', 'https://www.youtube.com/watch?v=USeEyhodZqk', 'https://www.youtube.com/watch?v=KoX80w5b8ps', 'https://www.youtube.com/watch?v=m4SBGLtJvPo', 'https://www.youtube.com/watch?v=2RQRoTvXXiw']
      },
      {
        "song": {
          "title": "Nothing Left To Say / Rocks (Medley)",
          "duration": 537
        },
        "videos": ['https://www.youtube.com/watch?v=Bn7eYibzmTs', 'https://www.youtube.com/watch?v=bSBkYqbdOKc', 'https://www.youtube.com/watch?v=B4z7loNm_kw', 'https://www.youtube.com/watch?v=Q6zqH6qKaTU', 'https://www.youtube.com/watch?v=zCqHNBleR6M']
      },
      {
        "song": {
          "title": "Cha-Ching (Till We Grow Older)",
          "duration": 249
        },
        "videos": ['https://www.youtube.com/watch?v=rmqyXQf8jkU', 'https://www.youtube.com/watch?v=vhSvfxtlUQc', 'https://www.youtube.com/watch?v=wO0ohGn-x3E', 'https://www.youtube.com/watch?v=IgC8yZpMRqc', 'https://www.youtube.com/watch?v=zTingWDAAts']
      },
      {
        "song": {
          "title": "Working Man",
          "duration": 235
        },
        "videos": ['https://www.youtube.com/watch?v=m4SBGLtJvPo', 'https://www.youtube.com/watch?v=2d-GIw-pBMs', 'https://www.youtube.com/watch?v=NARf6QW3KYA', 'https://www.youtube.com/watch?v=31YTMhD4NYs', 'https://www.youtube.com/watch?v=mhXoXYbmCz4', 'https://www.youtube.com/watch?v=2d-GIw-pBMs', 'https://www.youtube.com/watch?v=aW8_7M8e5CQ']
      }
    ];

    return testTracks(tracks, artistName);
  });

  // Failed, but the videos it finds are unavailable
  // Should update testTracks() so it checks if the video is available or not
  // it('should find YouTube videos for Night Shift (Original Mix) by Overwerk', function () {
  //   this.timeout(10000);
  //
  //   let artistName = "Overwerk";
  //   let tracks = [
  //     {
  //       song: {
  //         title: "Night Shift (Original Mix)",
  //         duration: 541
  //       },
  //       videos: ['https://www.youtube.com/watch?v=SI2wnEvrepM', 'https://www.youtube.com/watch?v=87bCbQHez9k', 'https://www.youtube.com/watch?v=dtq9NNLa1O8']
  //     },
  //     {
  //       song: {
  //         title: "Last Call (Original Mix)",
  //         duration: 600
  //       },
  //       videos: ['https://www.youtube.com/watch?v=4C9LACMJFT4', 'https://www.youtube.com/watch?v=eQMXBaB0Ehs', 'https://www.youtube.com/watch?v=RzKCHDgQZ9g']
  //     }
  //   ];
  //
  //   return testTracks(tracks, artistName);
  // });

  it('should find YouTube videos for single letter artist M', function () {
    this.timeout(10000);

    // It's a French song
    alltomp3.regionCode = 'FR';

    let artistName = "M";
    let tracks = [
      {
        song: {
          title: "Je dis aime",
          duration: 236
        },
        videos: ['https://www.youtube.com/watch?v=6hV-UnrC9tU', 'https://www.youtube.com/watch?v=QYWV67qgHvg', 'https://www.youtube.com/watch?v=ORam68OtcmY']
      },
      {
        song: {
          title: "Mama Sam",
          duration: 195
        },
        videos: ['https://www.youtube.com/watch?v=avZTCTR6e9k', 'https://www.youtube.com/watch?v=HRez3YiXxJw']
      }
    ];

    return testTracks(tracks, artistName);
  });
});
2021-06-18 17:06:29 +02:00
tastytea 245933a50e
Removed ARD download button.
It doesn't work anymore, I can't figure out how to extract the URL.
2021-05-04 02:24:44 +02:00
tastytea 72a0eebcd7
Fix DLF kultur button placement. 2021-04-29 13:51:46 +02:00
tastytea 29c5109c0a
Goodreads expand: Expand author info on book pages. 2021-04-24 22:08:21 +02:00
tastytea c555e69ad1
Goodreads expand: Expand book details too. 2021-04-20 09:47:44 +02:00
tastytea 5f5cc9257a
Ignore logs from LSP. 2021-04-20 09:46:21 +02:00
tastytea acfde28419
goodreads expand: Also expand author info. 2020-08-18 00:31:22 +02:00
tastytea 82af43deef
goodread expand: Fix @downloadERL. 2020-08-17 22:24:50 +02:00
tastytea d76799219d
Add goddreads expand. 2020-08-17 22:23:17 +02:00
tastytea 86076ad7f0
npr_text_only: Support transcripts. 2020-06-14 18:32:09 +02:00
tastytea 1fe591e06d
Fix ARD download-button. 2020-05-26 01:14:44 +02:00
tastytea 5769654af0
mastodon_cw_toggle: Make it work with newer Mastodon versions. 2020-05-19 00:55:15 +02:00
tastytea 65db601065
DHL redirect doesn't work anymore. 2019-08-23 02:59:16 +02:00
tastytea a1104d5fdc
ccc_media_player_down: Move above the share-widget.
because “Related” is not always there.
2019-08-10 17:33:08 +02:00
tastytea 480bf91811
mastodon_cw_toggle: Convert a to button. 2019-08-09 15:15:42 +02:00
tastytea bfb5bb4b96
dlf_download_button: Fixed URL detection. 2019-07-11 18:15:07 +02:00
tastytea 0b617420d1
npr_text_only: Fixed regular expression.
The regular expression was too specific, I made it more general.
2019-07-06 05:32:02 +02:00
tastytea cf030b1593
Added NPR text only. 2019-07-06 05:15:35 +02:00
tastytea ea0ac347f0
Moved dlf_download_button to audio/. 2019-07-04 15:24:01 +02:00
tastytea ad015f936a
Added dlf_download_button. 2019-07-04 15:20:54 +02:00
tastytea ecbf662cd3
dhl_redirect_tracking_page: Fixed regex. 2019-06-28 13:47:02 +02:00
tastytea 0842e76d5e
pleroma_cw_toggle: Fixed static vs. dynamic detection. 2019-06-25 01:26:42 +02:00
tastytea c82e31b6f9
pleroma_cw_toggle: Fixed bug I introduced with interactions-support. 2019-06-25 00:32:42 +02:00
tastytea 67811cb59b
pleroma_cw_toggle: Added support for interactions. 2019-06-24 19:19:30 +02:00
tastytea b4a1fb7b1f
ard_download_button: Added fix for WDR shenanigans. 2019-06-22 05:30:22 +02:00
tastytea 821fa97ce4
arte_download_button: Run every 2 seconds. 2019-06-22 05:16:47 +02:00
tastytea d4bdea2f3b
ard_download_button: Run forever. 2019-06-22 05:15:58 +02:00
tastytea 4f23f2514e
ard_download_button: Use submatch. 2019-06-22 05:11:18 +02:00
tastytea 2f1f7d718e
ard_download_button: I made it way too complicated, lol. m) 2019-06-22 05:01:05 +02:00
tastytea 5b6d87d24d
ard_download_button: Fixed standard format. 2019-06-22 04:52:57 +02:00
tastytea cd49920077
ard_download_button: Fixed 960x544 format. 2019-06-22 04:36:43 +02:00
tastytea 2e1e6d8416
ard_download_button: Added support for format516040.mp4-URLs. 2019-06-22 04:08:33 +02:00
tastytea 1b35d0cbac
ard_download_button: Return URL of HD m3u. 2019-06-22 03:44:51 +02:00
tastytea 8eda139962
ard_download_button: Oops, forgot to rename all occurences. 2019-06-22 03:34:15 +02:00
tastytea 9d4fe2185b
ard_download_button: Added support for master.m3u8-URLs. 2019-06-22 03:30:23 +02:00
tastytea a7c7411bb0
Added comment to ard_download_button and reformatted. 2019-06-22 01:36:03 +02:00
tastytea 759b2023ca
Added ARD download button. 2019-06-22 01:29:19 +02:00
tastytea c21b67d1a1
Added CCC-media video-player down-mover. 2019-06-18 22:37:46 +02:00
tastytea 5602b4a7e3
arte_download_button: Renamed functions and variables names.
They are more descriptive now.
2019-06-18 21:01:07 +02:00
tastytea b20488dc0f
Forgot a dot. It bugged a lot, so I did not let it rot. 2019-06-18 20:53:46 +02:00
tastytea 0c9abd4fb8
ndr_download_button: Do not add button if there is one already. 2019-06-17 13:48:48 +02:00
tastytea a28fe215e3
Added deprecation warning to ndr_hd_button. 2019-06-17 13:17:27 +02:00
tastytea b780ad9e75
ndr_download_button: Replace hq.mp4 with mp3 for audio files. 2019-06-17 13:05:50 +02:00
tastytea 3c88b413c6
Added audio functionality to NDR download button and renamed it. 2019-06-17 12:56:51 +02:00
tastytea b0dad67031
arte_download_button: Moved button to the right. 2019-06-15 23:26:04 +02:00
tastytea c6e3616c7b
Added arte_download_button. 2019-06-15 22:27:35 +02:00
tastytea 492630e1c1
tagesspiegel_show_comments: Show all answers to comments too. 2019-06-14 13:54:52 +02:00
tastytea 548927d609
ndr_hd_button: Added style needed for shine effect. 2019-06-14 00:26:38 +02:00
tastytea 8c4a521984
ndr_hd_button: Changed description to plural. 2019-06-14 00:21:51 +02:00
tastytea 57ae89160a
ndr_hd_button: Changed name and description slightly. 2019-06-14 00:09:41 +02:00