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
trackList[document.location.href]['item_1n361'] = {
seq: trackList[document.location.href].length,
type:'normal',
id:'1n361',
time:'266',
ts: '1340722642',
postid:'1852087',
posturl:'http://www.gorillavsbear.net/2012/06/26/mp3-premiere-erika-spring-hidden-jensen-sportag-remix/',
fav:'0',
key: 'c3f03b16ecce82ef18b6bf6e25c8e52b',
artist:'Erika Spring',
song:'Erika Spring -Hidden_ (Sportag Remix)_MS...',
thumb_url_large: 'http://static-ak.hypem.net/images/blog_images/15203.png'
};
trackList[document.location.href].push(trackList[document.location.href]['item_1n361']);
My regular expression
#old regex
idMatches = re.findall("[ t]id:'(w*)(?=')", contents)
keyMatches = re.findall("(?<=tkey: ')w*(?=')", contents)
songMatches= re.findall("(?<=tsong:').*(?=')", contents)
artistMatches= re.findall("(?<=tartist:').*(?=')", contents)
#new regex
idMatches = re.findall("s+id:s*'(.+)'", contents)
keyMatches = re.findall("s+key:s*'(.+)'", contents)
songMatches = re.findall("s+song:s*'(.+)'", contents)
artistMatches = re.findall("s+artist:s*'(.+)'", contents)
If you are more of a wiz at regex than me please recommend a better pattern :)