Catching Up: Hypescript fixed. More to come.

Finally have some time

I’ve received numerous (very nice hearing how many people have been using my software) e-mails and responses regarding how my hypescript and batch downloader are no longer working.

I’ve recently accepted a new position at Amazon in Seattle and the move was very time consuming. I was saddened at the state of the code and how I felt like I was letting people down by not fixing it in a timely fashion. Now that it’s been a month or so since my move I’ve finally had time to work on fixing them for you guys! 🙂

The fix

The HypeMachine guys keep breaking the script due to my terrible regular expression I was using to scrape the site for the id & keys. I’m hoping the current regex I’ve updated it to is more robust and will thwart a few more attempts from them from breaking it!

What needs to be parsed

My regular expression

If you are more of a wiz at regex than me please recommend a better pattern 🙂

16 Replies to “Catching Up: Hypescript fixed. More to come.”

  1. it looks like the extension isn’t working anymore…well at least with my mac at home ( 10.5.8 ) . My mac at work running lion and prob the latest version of chrome works still.

  2. I use the script every day, hope you’ll update it Farid 🙂

    It stopped working for me 4 or 5 days ago.

    Just says “Found 0 songs.”

  3. Hello,
    I don’t know how to use git hub, but I wrote some new regex for you guys. Tested and working as of today.

    Works based on assumptions of the JSON format. Searches based on “”:”” pattern. Will accommodate any kind of spacing within the fields.
    #Key:
    ‘[,”]+[^”]*?key[“:]+(w+)[,”]+’
    #Id:
    ‘[,”]+[^”p]*?id[“:]+(w+)[,”]+’
    #Song:
    ‘[,”]+[^”]*?song[“:]+(w+)[,”]+’
    #Artist:
    (‘[,”]+[^”]*?artist[“:]+(w+)[,”]+’);

  4. [wW]

    Sorry, that was premature, see below for revised regex

    ‘(?<!=)[,"]+[^"p]*?id[":]+(w+)[,"]+'
    '(?<!=)[,"]+[^"]*?key[":]+(w+)[,"]+'
    '(?<!=)[,"]+[^"]*?song[":]+([wW]+?)[,"]+'
    '(?<!=)[,"]+[^"]*?artist[":]+([wW]+?)[,"]+'

  5. tim, thanks for posting.

    I can’t get the formatting to work, could you post the complete lines of code from your hypeme.py script, please?

    Thanks
    /Martin

  6. tim, it works now, it looks like the first pling –> ‘ in line 1 has the wrong formatting.

    One thing I noticed is, that it wouldn’t download this song:
    (37ea67fe5689988150e108807fd3c8df, Obedear (Noah Hydes Magic Sword Remix), Purity Ring/Noah Hyde/ Magic Sword)

    I think it’s because of the forward slashes “/” in the name – any way to fix that?

    Thanks again 🙂
    /Martin

  7. Hey! I REALLY love your script! I wanted to give you a heads up though that on my version of Chrome (21.0.1180.83 m) the plugin no longer will install due to the deprecation of using manifest 1. If you do any updates, please include them with manifest 2 so that it works again 🙂 Thanks!

  8. @tim:

    Thanks for pointing that one out. The regex pattern assumed that the song name and artist would contain only letters and spaces.
    [wW]

    Slightly more complicated version:

    (?<!=)[,"]+[^"]*?song[":]+(.+?)(?<!\)[,"]+
    (?<!=)[,"]+[^"]*?artist[":]+(.+?)(?<!\)[,"]+

    Can handle any character in the name. It will also ignore quotations marks in the name, as long as they are escaped.

    All working:
    "song":"Aus"tra" = Aus"tra
    "song":"Aus/ra" = Aus/ra
    "song":"Aus()ra" = Aus()ra

  9. @tim: Could you post the complete lines from the hypeme.py script please?

    I tried copy/pasting your new regex in, but I get syntax errors.

  10. @tim: Hey Tim

    Here you can see my 2 lines from hypeme.py, Python 2.7 gives me an “unbalanced parenthesis” error:

    songMatches = re.findall(‘(?<!=)[,"]+[^"]*?song[":]+(.+?)(?<!\)[,"]+', html_contents)
    artistMatches = re.findall('(?<!=)[,"]+[^"]*?artist[":]+(.+?)(?<!\)[,"]+', html_contents)

Leave a Reply

Your email address will not be published. Required fields are marked *