Code Monkey home page Code Monkey logo

new-jiosaavn-downloader-chrome-extension's People

Contributors

ank-cha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

new-jiosaavn-downloader-chrome-extension's Issues

Download buttons do not load on Chromium

On Chromium Version 80.0.3987.87 (Official Build) Built on Ubuntu, running on LinuxMint 18.2 (32-bit)
I've loaded the extension and opened jiosaavn.com. However the download buttons beside the songs or even the song bitrate dropdown list on the top bar doesn't load.

Quite interestingly, if I keep refreshing or, remove the extension and reload it again and refresh the page, it works fine.
Is it a network speed issue?
Sometimes, the download buttons will show on some pages (of jiosaavn.com) and for others they don't.
maybe this gives out something-- the error spit out from the extension manager page.
image

..and tysm for the great work you've done!

Download quality is not 320 kbps.

I selected the download quality of 320 kbps from the dropdown besides my username. However, the quality of the songs is not really 320 kbps. Just their sizes are increasing. I do have jio saavn pro subscription and the songs in the app are fairly more clearer and of the best quality.

Is there any problem here? I suppose the switching to 320 kbps just adds random noise in the song to increase its size. I'm assuming this because songs downloaded in 120 kbps are more clearer than those with 320 kbps using your extension.

Please let me know if you work on it and manage to provide the true 320 kbps quality.

Small Album Art

Downloaded songs have very small (150x150) album art. Please make to downloadable with larger (500x500) album art.

Uncaught TypeError: Cannot read property 'classList' of undefined

Context
https://www.jiosaavn.com/
Stack Trace

src/inject/inject.js:211 (anonymous function)

/**

 * Add Player Download Button to Download Current Song
 * NOTE : Doesn't Work when used in Extension
 */
var playerDownloadButton = function () {

	$('.download-btn').remove();

	var btn = $('<a class="download-btn btn x-small" target="_blank" download>Download</a>');

	btn.css({
		float: 'right',
		background: '#7902FF',
		marginRight: '-30px',
		marginTop: '-3px',
	});

	$('.meta-wrap').append(btn);

	btn.on('click', function (e) {

		btn.text('Downloading...');

		var song = Player.getCurrentSong();

		getDownloadURL(song, false, function (result, status) {

			if(status === 'success') {
				var el = $('<a download></a>');
				el.attr('href', result.auth_url).attr('target', '_blank').attr('download', slugify(song.title));
				el[0].click();

				btn.text('Download');
			}

			if(status === 'error') {
				btn.text('Error in Download');
				console.log('Download error', result);
			}
		});

	});

};

/**
 * Add Download Button To Single Songs on the Screen
 */
var addDownloadButtonToAllSongs = function () {

	$('.single-download-button').remove();

	$('.song-json').each(function() {
		var $this = $(this);
		var btn = $('<a class="single-download-button btn x-small"></a>');

		var song = JSON.parse($this.text());


		btn.text('Download').css({
			marginLeft: '7px',
			fontSize: '8px',
			padding: '1px 11px',
			background: '#7902FF'
		});

		btn.on('click', function (e) {
			e.preventDefault();
			var $btn = $(this);
			$btn.text('Downloading....');

			getDownloadURL(song, false, function (result, status) {


				if(status === 'success') {
					downloadWithData(song, result.auth_url, function () {
						$btn.text('Download');
					});
				}
				if(status === 'error') {
					$btn.text('Error in Download');

				}

			});
		});


		$this.parent().find('.main .title').first().append(btn);
	});
};

/**
 * Add Album Download Button on Albums
 */
var addAlbumDownloadButton = function () {
	$('.album-download').remove();

	var albumBtn = $('<li><a class="album-download btn white outline">Download</a></li>');

	albumBtn.on('click', function () {

		var songs = [];
		$('.song-json').each(function () {
			songs.push(JSON.parse($(this).text()))
		});

		downloadSetOfSongsAsZip(songs, songs[0].album + bitrateString);

	});

	$('.album-view section .page-header .actions').prepend(albumBtn);
};

/**
 * Add Download Button on Playlist
 */
var addPlaylistDownloadButton = function () {

	$('.playlist-download').remove();

	var playlistBtn = $('<li><a class="playlist-download btn">Download</a></li>');

	playlistBtn.on('click', function () {

		var songs = [];
		$('.song-json').each(function () {
			songs.push(JSON.parse($(this).text()))
		});

		downloadSetOfSongsAsZip(songs, $('.page-title').text() + bitrateString);

	});

	$('.playlist .page-header .actions').prepend(playlistBtn);
};

/**
 * Add Download Quality selector on the Menu..
 */
var createDownloadQuality = function () {
	var self = this;
	var menuItem = $('<div id="language"><span class="curr-down-rate"></span><strong>Download Quality</strong></div>').addClass('menu text right');
	var dropDown = $('<div class="drop"></div>');
	var dropDownList = $('<ol></ol>');

	var bitrates = ['320', '192', '128', '64','32','16'];

	menuItem.find('.curr-down-rate').first().text(localStorage.download_bitrate + " kbps");
	bitrates = bitrates.map(function (rate) {


		var el = $('<li><a>' + rate + ' kbps</a></li>');

		if(rate === localStorage.download_bitrate) {
			el.addClass('current');
			el.find('a').first().append('<em class="current">current</em>');
		}

		el.on('click', function () {
			localStorage.download_bitrate = rate;
			$(this).parent().find('.current').each(function () {
				$(this).removeClass('current');
				$(this).find('a em').remove();
			});

			$(this).addClass('current');
			$(this).find('a').first().append('<em class="current">current</em>');

			menuItem.removeClass('active');
			menuItem.find('.curr-down-rate').first().text(localStorage.download_bitrate + ' kbps');

		});
		return el;
	});

	menuItem.hover(function () {
		menuItem.addClass('active');
	},
	function () {
		menuItem.removeClass('active');
	});

	dropDownList.append(bitrates);
	dropDown.append(dropDownList);
	menuItem.append(dropDown);

	$("#header").find('.wrap').first().append(menuItem);
};

/**
 * Run on Plugin Initialization
 */
var initPlugin = function () {
	addDownloadButtonToAllSongs();
	addAlbumDownloadButton();
	addPlaylistDownloadButton();

	downloadStatus.create();
};

$(document).ready(function () {
	initPlugin();


	createDownloadQuality();

	// check if classes of the .page-wrap changes then add the buttons again
	var OldLen = 0;
	var inter = setInterval(function () {

 		var len = $('.page-wrap')[0].classList.length;

		if(len !== OldLen) {
			initPlugin();
		}

		OldLen = len;
	}, 500);

});

Error

211 varlen = $('.page-wrap')[0].classList.length;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.