Amazon code for WP? March 4, 2008 7:11 AM Subscribe
Hey Matt and pb: You know that sweet-ass bit of code you guys have that scrubs any link to Amazon and inserts your affiliate ID? It would totally rock if you would release a version of that as a Wordpress plugin.
Seriously, I know it might be some work, but it sure would be useful. There are a handful of Amazon-themed WP plugins already, but none as simple and elegant as your solution.
Seriously, I know it might be some work, but it sure would be useful. There are a handful of Amazon-themed WP plugins already, but none as simple and elegant as your solution.
Step 1: Impementing a virtual cold fusion machine in PHP.
posted by Wolfdog at 8:07 AM on March 4, 2008 [4 favorites]
posted by Wolfdog at 8:07 AM on March 4, 2008 [4 favorites]
The other problem is that neither of us are WP plugin developers. So my Step 1 would be: learn the WP plugin API. Not that it wouldn't be fun, it's just that I might have a hard time getting motivated to do it if I'm not going to be using it.
posted by pb (staff) at 8:13 AM on March 4, 2008
posted by pb (staff) at 8:13 AM on March 4, 2008
So step one would really be to convert metafilter into a wordpress blog, I guess.
posted by Dave Faris at 8:21 AM on March 4, 2008 [3 favorites]
posted by Dave Faris at 8:21 AM on March 4, 2008 [3 favorites]
it really should be pretty simple to do using the wp filter hook. if no one else pops up with a finished product for you, maybe i'll push together some poop for you later this week.
should it filter both post content AND comments, or just comments?
posted by fishfucker at 8:36 AM on March 4, 2008
should it filter both post content AND comments, or just comments?
posted by fishfucker at 8:36 AM on March 4, 2008
No reason someone can't write a WordPress Amazon linking plugin of their own. The neat trick is you distribute the plugin for free with your own Amazon associates ID embedded in it. Anyone who uses your plugin without bothering to replace the ID = free referral money for you. I did something like this for Blosxom a few years back and I've made literally thousands of pennies over the years from it.
posted by Nelson at 8:40 AM on March 4, 2008 [5 favorites]
posted by Nelson at 8:40 AM on March 4, 2008 [5 favorites]
should it filter both post content AND comments, or just comments?
I would think both, for maximum world domination!
posted by jbickers at 8:51 AM on March 4, 2008
I would think both, for maximum world domination!
posted by jbickers at 8:51 AM on March 4, 2008
fishfucker, if you want to take a crack at it, I can drop the regex we have into pastebin and link it here.
posted by mathowie (staff) at 9:11 AM on March 4, 2008
posted by mathowie (staff) at 9:11 AM on March 4, 2008
here's the code for processing a variable with a few different regexes.
In english, the code basically says:
1. set the amazon referral code to the mefi one
2. if you spot a amazon.com URL with ASIN mentioned, chop everything off after the ASIN number in the URL, and tack on the referral code variable from step 1
3. same as step 2, but any amazon URL with the newer /gp/product/ stuff in the url
4. same as step 2, but any amazon URL with the old exec/obidos stuff in the url
5. same as step 2, but any amazon URL with the newest /dp/ stuff in the url
That's about it. I think it'd be a good thing to have for posts and comments on a WP blog, then you'd be sure that any amazon product mentioned would get your code attached to it, and any dorky comment spammers would be rewritten to benefit you instead of them.
Here is the CF documentation on the regex command, if you want to figure out all the syntax at play there.
posted by mathowie (staff) at 9:23 AM on March 4, 2008 [5 favorites]
In english, the code basically says:
1. set the amazon referral code to the mefi one
2. if you spot a amazon.com URL with ASIN mentioned, chop everything off after the ASIN number in the URL, and tack on the referral code variable from step 1
3. same as step 2, but any amazon URL with the newer /gp/product/ stuff in the url
4. same as step 2, but any amazon URL with the old exec/obidos stuff in the url
5. same as step 2, but any amazon URL with the newest /dp/ stuff in the url
That's about it. I think it'd be a good thing to have for posts and comments on a WP blog, then you'd be sure that any amazon product mentioned would get your code attached to it, and any dorky comment spammers would be rewritten to benefit you instead of them.
Here is the CF documentation on the regex command, if you want to figure out all the syntax at play there.
posted by mathowie (staff) at 9:23 AM on March 4, 2008 [5 favorites]
Why would someone use your plugin without bothering to replace the ID? I'm just looking for an insight into the human mind here.
posted by box at 9:31 AM on March 4, 2008
posted by box at 9:31 AM on March 4, 2008
Human + instructions --> misunderstanding. "Oh, it doesn't do that part for me?"
posted by Tehanu at 9:43 AM on March 4, 2008
posted by Tehanu at 9:43 AM on March 4, 2008
Why would someone use your plugin without bothering to replace the ID? I'm just looking for an insight into the human mind here.
People are stupid.
You'd be amazed how applicable that is.
posted by chrismear at 10:34 AM on March 4, 2008
People are stupid.
You'd be amazed how applicable that is.
posted by chrismear at 10:34 AM on March 4, 2008
Why would someone use your plugin without bothering to replace the ID? I'm just looking for an insight into the human mind here.
People are stupid.
Also, lazy.
posted by jedicus at 10:38 AM on March 4, 2008
People are stupid.
Also, lazy.
posted by jedicus at 10:38 AM on March 4, 2008
thanks matt, that saves me some time from having to look at all the diff. occurrences of amazon URLs.
please note that 'later this week' in programmer time is 'this month, maybe. or maybe next month'.
i probably will get a chance to look at it this week though
posted by fishfucker at 10:47 AM on March 4, 2008 [2 favorites]
please note that 'later this week' in programmer time is 'this month, maybe. or maybe next month'.
i probably will get a chance to look at it this week though
posted by fishfucker at 10:47 AM on March 4, 2008 [2 favorites]
oh, and fwiw, the actual operative match string in the regex looks pretty much like standard regex, so it should almost directly translate.
posted by fishfucker at 10:48 AM on March 4, 2008
posted by fishfucker at 10:48 AM on March 4, 2008
People are stupid.
Also, lazy.
Which causes them to make cynical generalizations.
posted by Ryvar at 10:49 AM on March 4, 2008 [2 favorites]
Also, lazy.
Which causes them to make cynical generalizations.
posted by Ryvar at 10:49 AM on March 4, 2008 [2 favorites]
People are stupid.
Also, lazy.
Which causes them to make cynical generalizations.
All of them.
posted by dersins at 11:01 AM on March 4, 2008 [2 favorites]
Also, lazy.
Which causes them to make cynical generalizations.
All of them.
posted by dersins at 11:01 AM on March 4, 2008 [2 favorites]
This reminds me -- I don't think it warrants its own thread but there's a hack to get better-quality videos from youtube by appending &fmt=6 or &fmt=18 to the url. I'd love for this to be added into the youtube links like the affiliate on Amazon links for the times I don't have the greasemonkey script handy.
posted by flatluigi at 12:17 PM on March 4, 2008 [11 favorites]
posted by flatluigi at 12:17 PM on March 4, 2008 [11 favorites]
Thanks flatluigi, just added &fmt=6 to the youtube player here. So if you watch the video via the MeFi player and a better-quality version is available, you should get it. I watched a few videos side by side and the standard versions are a little more artifacty (is that a word?), but it's not a huge difference in that little window.
posted by pb (staff) at 2:29 PM on March 4, 2008
posted by pb (staff) at 2:29 PM on March 4, 2008
People are stupid.
Also, lazy.
Which causes them to make cynical generalizations.
All of them.
But don't worry, at least they vote!
posted by Skorgu at 3:27 PM on March 4, 2008
Also, lazy.
Which causes them to make cynical generalizations.
All of them.
But don't worry, at least they vote!
posted by Skorgu at 3:27 PM on March 4, 2008
"... maybe i'll push together some poop ..."
This bizarre kind of phrasing is why I still adore fishfucker.
It's like thomcatspike without the earnestness.
posted by mr_crash_davis at 4:25 PM on March 4, 2008
This bizarre kind of phrasing is why I still adore fishfucker.
It's like thomcatspike without the earnestness.
posted by mr_crash_davis at 4:25 PM on March 4, 2008
pb: that doesn't work for me. I don't know if it used to work, I haven't used the mefi video for a while (firefox 2.0.0.12, windows. works fine if I follow the link to youtube)
posted by aubilenon at 6:27 PM on March 4, 2008
posted by aubilenon at 6:27 PM on March 4, 2008
aubilenon, how is it failing for you? After you enable the YouTube player in your preferences, do you get the little player icon next to youtube links? What happens when you click on it?
posted by pb (staff) at 8:35 AM on March 5, 2008
posted by pb (staff) at 8:35 AM on March 5, 2008
I don't know if this helps or not, but Feedburner will do that for any amazon link in your feed.
Go to feedburner.com, sign in, go to your feed, click on the Optimize tab, then look in the lower left hand side for the Amazon ID burner.
Granted it doesn't hit the front end, but at least you're getting some amazon love from your email feed subscribers.
- Bill
posted by willmize at 9:57 AM on March 5, 2008
Go to feedburner.com, sign in, go to your feed, click on the Optimize tab, then look in the lower left hand side for the Amazon ID burner.
Granted it doesn't hit the front end, but at least you're getting some amazon love from your email feed subscribers.
- Bill
posted by willmize at 9:57 AM on March 5, 2008
sorry that was not a helpful bug report.
1) Now it is working just fine.
2) Yesterday I was getting a lightbox style popup that was blue and said "close window", and the audio. No video was visible.
posted by aubilenon at 2:26 PM on March 5, 2008
1) Now it is working just fine.
2) Yesterday I was getting a lightbox style popup that was blue and said "close window", and the audio. No video was visible.
posted by aubilenon at 2:26 PM on March 5, 2008
poo pushed: Amazon Associate Filter.
It appears to be working, but I've only tested it with a few diff. links, so let me know if it deletes all your files or has sex with your mother or something.
wasn't bad at all -- took about 20 minutes to get the regexes to function and 40 minutes to locate the Wordpress documentation for adding admin pages so you can switch the associate id from the admin menu (dudes! better documentation navigation! you do everything else so well!).
posted by fishfucker at 4:08 PM on March 5, 2008
It appears to be working, but I've only tested it with a few diff. links, so let me know if it deletes all your files or has sex with your mother or something.
wasn't bad at all -- took about 20 minutes to get the regexes to function and 40 minutes to locate the Wordpress documentation for adding admin pages so you can switch the associate id from the admin menu (dudes! better documentation navigation! you do everything else so well!).
posted by fishfucker at 4:08 PM on March 5, 2008
fishfucker, you totally rock the mikestand. Outstanding! Powers-that-be, how about a sidebar nod?
posted by jbickers at 5:16 PM on March 5, 2008
posted by jbickers at 5:16 PM on March 5, 2008
nah, this ain't sidebar worthy.
it'll be on the wordpress plugins page soon enough, so people can find it there.
i also need to rewrite the regex so instead of scanning the content four times it just uses a single catch-all; didn't much about with that yet.
after that I'm going to make it read email.
posted by fishfucker at 6:54 PM on March 5, 2008
it'll be on the wordpress plugins page soon enough, so people can find it there.
i also need to rewrite the regex so instead of scanning the content four times it just uses a single catch-all; didn't much about with that yet.
after that I'm going to make it read email.
posted by fishfucker at 6:54 PM on March 5, 2008
That fmt=6 YouTube hack doesn't work for most browsers. It used to, but YouTube now seems to be sending the same higher-quality video with or without &fmt (at least for most browsers)
Testing on this trailer on Safari/OSX, it seems that the same 10.2Mb video is sent whether you use fmt=6 or not. but if you add &fmt=18, you get a lower-quality 8.0Mb video.
posted by rajbot at 7:27 PM on March 5, 2008
Testing on this trailer on Safari/OSX, it seems that the same 10.2Mb video is sent whether you use fmt=6 or not. but if you add &fmt=18, you get a lower-quality 8.0Mb video.
posted by rajbot at 7:27 PM on March 5, 2008
fwiw, I've updated the plugin so that it only uses a single preg_replace instead of four, and uploaded it to the wordpress plugin directory. You can now find it here: http://wordpress.org/extend/plugins/amazon-associate-filter/
posted by fishfucker at 3:04 PM on March 21, 2008
posted by fishfucker at 3:04 PM on March 21, 2008
You are not logged in, either login or create an account to post comments
posted by mathowie (staff) at 7:35 AM on March 4, 2008