<commit_before>"use strict";

var $          = require("jquery");
var Plugin     = require("../modules/Plugin");
var soundcloud = Object.create(Plugin);

soundcloud.init("soundcloud", "SoundCloud");

soundcloud.scrape = function () {
    var info, player, playing, soundcloudNext, listingInfo;

    soundcloudNext = !!$("body > #app").length;

    if (soundcloudNext) {
        playing = $(".sc-button-play.sc-button-pause");
        info = {
            stopped: !playing.length
        };

        listingInfo = playing.parents(".trackList__item").length > 0 ? ".trackList__item" : ".sound";
        if (!info.stopped) {
            player        = playing.parents(listingInfo);
            info.artist   = player.find(".soundTitle__username").text();
            info.title    = player.find(".soundTitle__title").text();
        }
    } else {
        playing = $(".play.playing");
        info = {
            stopped: !playing.length
        };

        if (!info.stopped) {
            player        = playing.parents("div.player");
            info.artist   = player.find(".user-name").text();
            info.title    = player.find("h3 a").text();
        }
    }

    return info;
};

module.exports = soundcloud;
<commit_msg>#40 bug fixes on Soundcloud; sounds and playlists are now found both in stream and sound mode<commit_after>"use strict";

var $          = require("jquery");
var Plugin     = require("../modules/Plugin");
var soundcloud = Object.create(Plugin);

soundcloud.init("soundcloud", "SoundCloud");

soundcloud.scrape = function () {
    var info, player, playing, soundcloudNext, compactArr;

    soundcloudNext = !!$("body > #app").length;

    if (soundcloudNext) {
        playing = $(".sc-button-play.sc-button-pause").not(".sc-button-medium").last();
        info = {
            stopped: !playing.length
        };

        if (!info.stopped) {
            if(playing.parents(".streamContext").length && playing.parents(".playlist").length){
                player        = playing.parents(".playlist").find(".active");
                compactArr    = player.find(".compactTrackListItem__content").text().split(/-(.+)?/);
                info.artist   = compactArr[0];
                info.title    = compactArr[1];
            } else {
                player        = playing.parents(playing.parents(".sound").length ? ".sound" : ".trackList__item");
                info.artist   = player.find(".soundTitle__username").text();
                info.title    = player.find(".soundTitle__title").text();
            }
        }
    } else {
        playing = $(".play.playing");
        info = {
            stopped: !playing.length
        };

        if (!info.stopped) {
            player        = playing.parents("div.player");
            info.artist   = player.find(".user-name").text();
            info.title    = player.find("h3 a").text();
        }
    }

    return info;
};

module.exports = soundcloud;

{'fraction_non_alphanumeric': 0.16056910569105692, 'fraction_numerical': 0.0023712737127371273, 'mean_word_length': 2.0411946446961893, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3282216', 'n_tokens_mistral': 842, 'n_tokens_neox': 811, 'n_words': 148}