Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Grooveshark downloader - enjoy :)
-
<b>Disclaimer:</b> This works in combination with a (free) third-party App Store app.
The app that this script works in combination with is called 'iDownloads PLUS - Download Manager!', free, from Amad Marwat, in the iOS app store. I am not affiliated with him, it's just free and very useful (can download in the background with notifications when complete, can download multiple files, can play .mp3 files directly, has HTTP sharing and iTunes documents capabilities for transfer to a computer, and also has 'Open in ...' capabilities to move them to another app). Unfortunately for this script, Mobile Safari cannot directly be used as it lacks an 'Open in ...' capability to move .mp3 files to other apps.
<b>This script is a Grooveshark search + download tool.</b> It allows you to enter what you're looking for, gives you the top 8 results, then helps you download the .mp3.
https://gist.github.com/pudquick/5606582
Unlike other attempts at third-party Grooveshark libraries, I've attempted to do several things to help keep this client from being banned:
<ul><li>Download files likely to be downloaded by a real browser.</li>
<li>Mask the User-Agent of the browser.</li>
<li>Retain cookies handed out by the site.</li>
<li>Use the HTML5 version of the site so I can avoid needing to parse the Flash player.</li>
<li>Dynamically pull special values instead of hardcoding them.</li>
<li>Enforce the 30 second timer that fires when you've listened to an entire song.</li></ul>
All of these things should help to make sure that you don't get banned. Note: If you do get banned (downloading too many songs too quickly), the ban should lift in 10 minutes or so - try again later. <b>I have no clue if this script will work outside of the US.</b> They're very geographically picky about who can use their site.<b>How it works when you run it:</b>
<ol><li>The script will attempt to import requests module version 1.2. If it's not found, it will automatically download it and install it as requests_1_2.</li>
<li>Once loaded, it will present a menu. Right now there is just a single choice '1) Search and download' (I'll add some more later). Enter 1, then enter your search term (like the name of a song).
<img src="http://i.imgur.com/I534tz2.png"></li>
<li>It will lookup your entry and provide the top hits (up to 8) for a match. Enter the number of the match you want to download.
<img src="http://i.imgur.com/prS8pXk.png"></li>
<li>The download will then start, with progress indicators. As noted, the download will take a minimum of 30 seconds to help ensure you're not banned.
<img src="http://i.imgur.com/G1xFbf0.png"></li>
<li>When complete, iDownloads+ will automatically launch (make sure you have it installed). <b>You can just hit the 'Download'</b> button as I've configured the script to attempt to offer a decent name for the .mp3. When the transfer is complete (it will be quick), you can go back to the script. It will automatically clean up and offer to run again.
<img src="http://i.imgur.com/nIzgs3F.png"></li>
<li>Entering 0 or nothing for an entry will cause it to quit.</li></ol>
(<a href="http://imgur.com/a/7nJwL">album with images here</a>)As noted before in my Soundcloud downloader, the limitations of iOS make it so that .mp3 files you download can't be added to your device's music library programmatically. You'll have to save the .mp3 file from your device to iTunes and then sync it back to your device (or have a separate music player app, of which there are many, that you can 'Open in ...' the .mp3 file). In the meantime, iDownloads+ also offers a built-in media player so you can get to the listening :)
As always, hope you guys enjoy! ☺
I've already got the mechanics figured out for downloading playlists, just wanted to get the initial version published and out there for others to try.
-
Side note: .mp3 files are stored temporarily in the gs_dl folder that it creates.
If something goes wrong with the script, you can delete the folder in the Pythonista interface and it'll clear out everything that's in there (whether it's shown or not).
-
Awesome, I was wondering if this was possible. It's too cool that you decided to do it without anyone having to ask :D
-
Gotta say, transferring the downloaded file to another app with a local http server is pretty clever! Unfortunately, I can't try this because Grooveshark isn't available in Germany.
-
@omz - I've used the http server + app method for a couple of my scripts in here (Mega client, for one). This script contains a variant of SimpleHTTPServer I've been developing that has sane timeouts, limited number of responses, etc. (instead of .serve_forever). Side request: please include a newer requests module in the next release - it's gone through some major changes that are useful.
@eliskan - Well, I've done Youtube, Soundcloud, Mega, and Grooveshark. They've all been fun. Got another suggestion?
-
Pandora is a consideration, but personally I have always used Grooveshark ever since I wanted specific choice so Pandora isn't a big deal for me.
However I would like to report one issue I had with this script, a very small one (probably related to my wifi sucking).. Many of the downloads simply stopped, and never proceeded. There's no easy way to stop the script while downloading (like a 'cancel' button) when the download freezes. For example it gets to 42% then ceases entirely. At that point I would check Safari and internet works.
Even if I hit the 'stop' button in Pythonista, the script will continue to play until I close Pythonista entirely and reboot it.
It would be nice to have a 'cancel' prompt during downloads that can stop the script from running, or something along those lines, without taking up too many resources. When the script is cancelled, if the file is corrupt it might be a good idea to automatically delete.
I do love this script and like the YouTube one before, it works in GoodReader if you replace ''iDownloads://' with 'ghttp://' on line 313
-
I also have that same problem,
Would anyone know the reason why? -
I have an idea... It looks like the error is from Line 204:
base_snip = re.search(r'window\.GS\.config.+?(\{.+?\});', self.base_html).groups()[0]
Looking into it...
-
So just in case anyone runs across this page, here is the fix. This illustrates ones of the major problems with screen scraping: authors change the structure of their content and it ruins your day.
Replace Line 204:
base_snip = re.search(r'window\.GS\.config.+?(\{.+?\});', self.base_html).groups()[0]
With:
base_snip = re.search(r'GS\.config.+?(\{.+?\});', self.base_html).groups()[0]
Notice: the only thing changed was removing "window.". The reason this is happening is that GrooveShark changed the structure of that particular piece of JavaScript so the regex doesn't match anything anymore. The regex searching does not have a "graceful" failure, so it just crashes the whole application without really telling you why: it can't find the string it's looking for!
Have a stupendous day!
PS: emailing the author of this post now in hopes he can update on github -
thank!
-
Did not work
-
Did you get the same error mentioned above?
The error I am getting now is that no search results were found. The problem seems to be with
_getResultsFromSearch
Hoping the developer can help us out :) I'll update when I know more
-
Yea it looks like the session information isn't being handled properly. Maybe due to a change on the GrooveShark side? The client isn't able to present a valid token or some such nonsense. Unfortunately I am not very familiar with handling json object or session info... But I love this tool and will try to fix it.
-
The app is trying to post this in the _doAPICall. Can anyone help out?
{"header":{"session":"9c9afeaf0f6d46cc9855465d095ed197"},"fault":{"code":256,"message":"invalid token"}}
-
This post is deleted! -
This post is deleted! -
This post is deleted! -
This post is deleted!