PDA

View Full Version : Miscellaneous Hacks - Dynamic Amazon Links


felxi
11-21-2007, 10:00 PM
Description
This Hack will easily rewrite all amazon links whitin the posts to your associate id. You can add your amazon.de and amazon.com associate id, links to both amazon stores will be replaced with the right id, it works fine with multilanguage boards.

vBulletin
vB 3.6.x working
vB 3.5.x working

updating
just upload the functions_amazon_links.php from the zip and don't forget to insert your amazon ids.

Change Log
25/11/2007 v1.05
- support for [ url=xxx]yyy[ /url]
- replacement for tag=xxx and ref=xxx in non asin links
- small fix for /preview/ links

24/11/2007 v1.04
- [url]amazon-link[ /url] long amazon links will be shorten vb like

23/11/2007 v1.03
- [url] and [url="xxx"] will be repleaced

weeno
11-23-2007, 12:08 AM
Thank you for taking this up. I've been trying to get the previous one to work, but unless the parsings perfect (in that it doesn't break in any scenario) then I'm reluctant to deploy it on my site.

downloading/testing.

edit: It's not working for me. links are not getting processed at all. Looks like lower case [url] aren't processed.

thanks
arn

redlabour
11-23-2007, 05:50 AM
Great - but does it work with vbAnonymizer (https://vborg.vbsupport.ru/showthread.php?t=131292&highlight=vbanonymizer) installed?

felxi
11-23-2007, 06:23 AM
edit: It's not working for me. links are not getting processed at all. Looks like lower case [url] aren't processed.


@arn:
i made a little update and tested it. now the script will also replace [url] and [url="xxx"] instead of [URL] and [URL="xxx"].

@redlabour: i'll test it this evening to get it working.

Best regards,
Felxi

weeno
11-23-2007, 06:37 AM
@arn:
i made a little update and tested it. now the script will also replace [url] and [url="xxx"] instead of [URL] and [URL="xxx"].


The lowercase still isn't working for the [url="xxx"]

example:
[url="http://www.amazon.com/Logitech-970155-0403-V20-Notebook-Speakers/dp/B0009WKBGC"]these[/url]

arn

felxi
11-23-2007, 07:03 AM
example:
these (http://www.amazon.com/Logitech-970155-0403-V20-Notebook-Speakers/dp/B0009WKBGC)


It should work now, I updated the script. You can test your link-codes in the functions_amazon_links.php and run this php file direct:


<?php
echo amazon_links('some text
link text here (http://www.amazon.com/Logitech-970155-0403-V20-Notebook-Speakers/dp/B0009WKBGC)');


function amazon_links($text) {
// ...
}
?>

weeno
11-23-2007, 07:26 AM
It should work now, I updated the script. You can test your link-codes in the functions_amazon_links.php and run this php file direct:


Thanks. appears to be working well. I'll test it more extensively when I have time this weekend. again, appreciate the effort.

arn

reteep
11-23-2007, 07:46 AM
Seems to work dude, good job!

daFish
11-23-2007, 07:49 AM
Great release. I assume this works with the 3.6-series?

reteep
11-23-2007, 07:52 AM
Great release. I assume this works with the 3.6-series?

Yea, running it on the latest 3.6.

projectego
11-23-2007, 02:59 PM
* projectego clicks install :)

weeno
11-24-2007, 04:09 AM
Another issue.

It seems that using this hack removes vbulletin's auto truncate feature in long urls.

For example:

Without the hack, long urls are shortened. Example:

h_ttp://www.amazon.com/Microsoft-Offi...5878848&sr=8-1

Once you install the hack, the url ends up being very long, and not auto truncated.

h_ttp://www.amazon.com/Microsoft-Office-2004-Student-Teacher/dp/B0001WN16M/ref=pd_bbs_1?ie=UTF8&s=software&qid=1195878848&sr=8-1

bada_bing
11-24-2007, 04:46 AM
Reserved

felxi
11-24-2007, 09:08 AM
Another issue.
It seems that using this hack removes vbulletin's auto truncate feature in long urls.



Hey weeno,
thanks for the report. the truncate feature is now added to the script.

In general the displayed link e.g. [url ] amazon-link [ /url] will get [url="new-amazon-link" ] amazon-link [ /url], so the displayed post-text isn't changed :).

Greetz,
felxi

djbaxter
11-24-2007, 01:13 PM
Wow!

I've tried a few of these before, both for vBulletin and WordPress. This is the first one that actually WORKS for me.

Well done! :)

I made a slight modification to the plug-in that might be useful to others...

In functions_amaxzon_links.php, find at lines 6-7:

/*
* your partnernet ids
*/
$associate_id_de = 'xxxxxxxxx'; // or leave empty
$associate_id_com = 'xxxxxxxxxxx'; // or leave empty

Since I don't have or need an amazon.de account but I do have another regional account, I changed this to:

/*
* your partnernet ids
*/
$associate_id_de = ''; // or leave empty
$associate_id_com = 'xxxxxxxxxxx'; // or leave empty
$associate_id_ca = 'xxxxxxxxxxx'; // or leave empty

Then find two instances of

amazon.(de|com)

at lines 17-18 and 42-43. Change to:

amazon.(ca|com)

For other regional Amazons, use the appropriate regional extension instead of "ca".

weeno
11-24-2007, 08:37 PM
two more "issues"

1.

It breaks this link:
http://www.amazon.com/review/product/B000V1VG5G/ref=dp_top_cm_cr_acr_txt?%5Fencoding=UTF8&showViewpoints=1

since it has an ABIN number but is not meant to go to the product itself

2.

It doesn't handle [url=http://www.link.com]text[/url] (without quotes)

Regarding #1, in a related note, I might even prefer the urls all to be redirect urls via Amazon rather than any in the more abbreviated ABIN version... since that way the final url is as intended by the origanal poster, and your referal code is no longer embedded in the final destination url. But that might be a personal preference.

thanks
arn

felxi
11-25-2007, 10:20 AM
hi weeno,
the issues are been solved. thank you for reporting.

regards,
felxi

weeno
11-25-2007, 07:23 PM
hi weeno,
the issues are been solved. thank you for reporting.

regards,
felxi

Thanks,

Do you forsee any problems if I modify it to use the redirect code on all links, even those with ABINs in them?

arn

g00gl3r
11-26-2007, 12:54 AM
reserved

djbaxter
11-26-2007, 03:36 PM
reserved

This is a serious question, not a flame: What is the purpose of a post like this? It seems to me it's more a non-post.

felxi
11-27-2007, 05:55 AM
Hey wenno,

I think the best conversion you can get is using ref=nosim, because the link will be a direct product link in this case.

Greets,
Felxi

g00gl3r
11-29-2007, 05:20 PM
This is a serious question, not a flame: What is the purpose of a post like this? It seems to me it's more a non-post.

Just saying I've reserved it for use on a forum in the future as I have no need for it currently. As the "mark if installed" feature promotes the trusted and used mods, I wanted to show I'd trust and use this mod.... but I haven't yet so haven't marked as installed.

I think you'll find many members do such a thing.

g00gl3r
11-29-2007, 05:27 PM
Wow!

I've tried a few of these before, both for vBulletin and WordPress. This is the first one that actually WORKS for me.

Well done! :)

I made a slight modification to the plug-in that might be useful to others...

In functions_amaxzon_links.php, find at lines 6-7:

/*
* your partnernet ids
*/
$associate_id_de = 'xxxxxxxxx'; // or leave empty
$associate_id_com = 'xxxxxxxxxxx'; // or leave empty

Since I don't have or need an amazon.de account but I do have another regional account, I changed this to:

/*
* your partnernet ids
*/
$associate_id_de = ''; // or leave empty
$associate_id_com = 'xxxxxxxxxxx'; // or leave empty
$associate_id_ca = 'xxxxxxxxxxx'; // or leave empty

Then find two instances of

amazon.(de|com)

at lines 17-18 and 42-43. Change to:

amazon.(ca|com)

For other regional Amazons, use the appropriate regional extension instead of "ca".

How would I get .co.uk work with this? Would amazon.(ca|com) become amazon.(co.uk|com) etc?

g00gl3r
11-29-2007, 05:33 PM
Wow!

I've tried a few of these before, both for vBulletin and WordPress. This is the first one that actually WORKS for me.

Well done! :)

I made a slight modification to the plug-in that might be useful to others...

In functions_amaxzon_links.php, find at lines 6-7:

/*
* your partnernet ids
*/
$associate_id_de = 'xxxxxxxxx'; // or leave empty
$associate_id_com = 'xxxxxxxxxxx'; // or leave empty

Since I don't have or need an amazon.de account but I do have another regional account, I changed this to:

/*
* your partnernet ids
*/
$associate_id_de = ''; // or leave empty
$associate_id_com = 'xxxxxxxxxxx'; // or leave empty
$associate_id_ca = 'xxxxxxxxxxx'; // or leave empty

Then find two instances of

amazon.(de|com)

at lines 17-18 and 42-43. Change to:

amazon.(ca|com)

For other regional Amazons, use the appropriate regional extension instead of "ca".

How would I get .co.uk work with this? Would amazon.(ca|com) become amazon.(co.uk|com) etc?

g00gl3r
11-29-2007, 05:35 PM
It seems this mod isn't compatible with the vbanonymizer or vbseo or something lol. When I installed it - it stopped my viewtopic pages from being displayed.

uninstalled.

g00gl3r
11-29-2007, 05:39 PM
I'm guessing it's this line I'd have to edit to get it to work.... if(preg_match_all("/\[url\=(?:\")?(http:\/\/(?:[A-z0-9\.]+)?amazon\.(de|com|ca|co.uk)\/(?:.+))(?:\")?](.+)\[\/url\]/iU", $text, $out)) {

But what would I change it to? it's this that I have:https://vborg.vbsupport.ru/showthread.php?t=131292

felxi
11-30-2007, 06:40 AM
it's working together with vbseo without any problemes. i gonna check it this evening.

pete_brady
12-04-2007, 10:15 PM
working for .com (albeit without truncation of links) but can't get it going for .co.uk at all.

Vinyljunky
12-07-2007, 09:22 AM
working for .com (albeit without truncation of links) but can't get it going for .co.uk at all.


Does anybody use this with VBSEO?

I also need it for .co.uk :)

VinylJunky

theinvisibleman
12-12-2007, 06:48 PM
anyone had any joy with co.uk?

pete_brady
12-17-2007, 10:29 PM
as well as .co.uk for amazon, i'm wondering would it be possible to add in support for other affiliate networks, either in this or a separate product?

For example, www.buy.at use their own standardised URLS to track affiliate referrals, so it should be straightforward enough(?) to add the appropriate prefix to any www.game.co.uk or www.play.com links:

Game.co.uk:
http://game-online.at/AFFILIATEID?DURL=http://www.game.co.uk/Xbox360/RolePlaying/~r328584/Mass-Effect/

Play.com:
http://playcom.at/AFFILIATEID?DURL=http://www.play.com/play247.asp?page=title&Cur=257&r=R2&title=135786

other affiliate networks just need a variable appended to the URL...

pete_brady
12-30-2007, 01:59 PM
anybody?

TRBoxman
01-04-2008, 08:31 PM
I'm interested in the same kind of mod. Something simple that will append affiliate ID's to selected URLs.

irishblacknight
01-05-2008, 04:29 PM
I'd be interested in using it if


it worked with co.uk
it worked with vbseo

Banana_man
01-16-2008, 02:49 PM
Me too, i have been looking around for a plugin for play.com but no look so far. I will also be installing vbseo soon so it would be great if it worked with that.

Vinyljunky
01-16-2008, 02:56 PM
I'd be interested in using it if


it worked with co.uk
it worked with vbseo


I second that or rather I 3rd that :D

Alfa1
01-18-2008, 02:32 PM
I am on vb 3,7 and it is not working for me. Please port this to vb 3.7

Also; I have a book review section where the amazon link is posted in a custom field. Can you please add a function to make this work for custom GARS fields?

sleepytom
01-19-2008, 09:55 AM
this works well for the usa - i'd really like to do amazon.co.uk too though (i tried to change the .ca support to .co.uk but it doesn't work) It shouldn't be too hard to get it going though for someone with some php skills (i'm really no good and this stuff!)

also is their a way to get this to work on all the amazon links on my forum? as i understand it this only adds the code to newly posted links as opposed to links that have been posted in the past.

ChrisSy
01-22-2008, 06:25 PM
Anyone got the code hacks to swap out .de for co.uk?

pete_brady
01-22-2008, 08:03 PM
Would it help if some cash was offered to get this coded up?

djbaxter
01-22-2008, 10:40 PM
Anyone got the code hacks to swap out .de for co.uk?

More importantly, working code? I don't know why this isn't simple but evidently the simple solutions don't work.

MotMann
01-28-2008, 09:53 PM
I use the older version, but 17 items will not be in the affilistatus in amazon.de. There are over 160 € missing :(

My ID Code is correct. I Think, there is a Problem, that the ID comes on the end of the URL?

redlabour
01-29-2008, 04:46 PM
Does it work with 3.7 ?

pete_brady
02-06-2008, 04:06 PM
Does it work with 3.7 ?

working fine for me on 3.7b4

still hoping for .co.uk

Dabbi
02-10-2008, 11:17 PM
Please excuse what may seem like a stupid request... Would someone please tell me which program I can both open AND save "functions_amazon_links.php" so I can modify it as required and still have it as a php?

I've found programs that will open it such as MS Word, Notebook, MS Publisher but for the life of me I'm not seeing how I can save it as a php. :o

Although this seems like a great mod I can't install it until I can get this part done so any help would be appreciated... thanks. :)

djbaxter
02-10-2008, 11:25 PM
Please excuse what may seem like a stupid request... Would someone please tell me which program I can both open AND save "functions_amazon_links.php" so I can modify it as required and still have it as a php?

I've found programs that will open it such as MS Word, Notebook, MS Publisher but for the life of me I'm not seeing how I can save it as a php. :o

Although this seems like a great mod I can't install it until I can get this part done so any help would be appreciated... thanks. :)

Download Crimson Editor (freeware) (http://www.crimsoneditor.com). An excellent editor with code highlighting, etc., to help you find missing brackets, closing tags, end quotes, etc.

Dabbi
02-11-2008, 12:50 AM
Thank you! That worked beautifully and I truly appreciate the help. :)

Sergioh
03-06-2008, 04:15 AM
How do I fully uninstall this? I deleted the plugin and deleted the php file and it's still showing the amazon icon.

nMIK-3
03-26-2008, 06:07 AM
Installed succesfully but how do I know that is working?

MetalAges
04-04-2008, 03:10 AM
Doesn't seem to work for me, using 3.6.8 with VBSEO. I recall on some other plugins I had to add the line: rel="novbseo" to URL code. Maybe the same with this?

felxi
04-08-2008, 06:31 AM
hey!

vbulletin stores the posts in the database and uses a cache (table: postparsed). To clear the cached old/new urls you have truncate this table.

this means... no cached postes will only be overwritten in the postparsed table. the original post is not overwritten (table: post).

after installing only new posts will be overwritten, but you can truncate the postparsed table as explained.

i hope this helps.

RobParker
04-19-2008, 02:37 PM
Has anyone got this working with .co.uk yet?

GoodKarmaKid
05-10-2008, 06:04 AM
Does this work with 3.70 gold?? This is exactly what I'm looking for.

Jason

pete_brady
05-25-2008, 06:11 AM
Has anyone got this working with .co.uk yet?

bump

Does this work with 3.70 gold?? This is exactly what I'm looking for.

Jason

yep working just fine

Phillip Chapman
06-02-2008, 01:48 AM
Can someone confirm whether or not this works with 3.6.10? Should my associates id be visible in the actual amazon URL if working properly?

Phillip Chapman
06-02-2008, 02:31 AM
It's working now. We noticed the links don't change in preview, only when a message has been posted.

buro9
06-05-2008, 09:46 AM
I've got this working for .co.uk

You can easily add .ca, .de or any two level .tld like .co.uk to this by adding:
$associate_id_ and then the .tld with the . replaced by _
$associate_id_co_uk is the UK one.

And of course add the bit in the preg_match to work with this.

Code for the file is thus:

<?php
function amazon_links($text) {
$associate_id_co_uk = 'buro9-21'; // or leave empty
$associate_id_com = 'buro9-20'; // or leave empty

$replace_targt_urls = true; // true or false

$replace_src = array();
$replace_str = array();

// check for some text (amazon-link)
if(preg_match_all("/\+)?amazon\.(co\.uk|com)\/(?:.+))(?:\")?](.+)\[\/url\]/iU", $text, $out)) {
for($i=0;$i<count($out[1]);$i++) {
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
$out[4][$i] = $out[1][$i];

if($associate_id && !empty($associate_id)) {
// Look for an asin number
if(preg_match("/\/[A-Z0-9]{10}(\/)?/", $out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
if(substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
} else {
$target_url = $out[1][$i];
if($replace_targt_urls) {
$target_url = preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'ref='.$associate_id, $target_url);
$target_url = preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'tag='.$associate_id, $target_url);
}

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
}

$replace_src[] = '';
$replace_str[] = '[URL="'.$out[1][$i].'"]';

$replace_src[] = '[URL='.$out[4][$i].']';
$replace_str[] = '[URL='.$out[1][$i].']';

$replace_src[] = '[url="'.$out[4][$i].'"]';
$replace_str[] = '[url="'.$out[1][$i].'"]';

$replace_src[] = '[url='.$out[4][$i].']';
$replace_str[] = '[url='.$out[1][$i].']';
}
}
} unset($out);

// check for [URL]amazon-link ('.$out[4][$i].')
if(preg_match_all("/\[url\](http:\/\/(?:[A-z0-9\.]+)?amazon\.(co\.uk|com)\/(?:.+))\[\/url\]/iU", $text, $out)) {
for($i=0;$i<count($out[1]);$i++) {
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
$out[4][$i] = $out[1][$i];

if($associate_id && !empty($associate_id)) {
// Look for an asin number
if(preg_match("/\/[A-Z0-9]{10}(\/)?/", $out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
if(substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
} else {
$target_url = $out[1][$i];
if($replace_targt_urls) {
$target_url = preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'ref='.$associate_id, $target_url);
$target_url = preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'tag='.$associate_id, $target_url);
}

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
}

$displayed_link = $out[4][$i];
if(strlen($displayed_link) > 55) {
$displayed_link = substr($displayed_link, 0, 36).'...'.substr($displayed_link, -14);
}


$replace_src[] = '[URL]'.$out[4][$i].'';
$replace_str[] = ''.$displayed_link." ('.$out[1][$i].')";

$replace_src[] = ''.$out[4][$i].'';
$replace_str[] = ''.$displayed_link." ('.$out[1][$i].')";
}
}
} unset($out);


// replace the message
if(isset($replace_src[0])) {
$text = str_replace($replace_src, $replace_str, $text);
} unset($replace_src, $replace_str);

return $text;
}
?>


Thanks for the great hack.

pete_brady
06-05-2008, 10:35 AM
i think i love you

edit: hmm i must be doing something wrong

pete_brady
06-05-2008, 05:49 PM
ok did some more tests.

the hack works when i post a raw link, but not when i post it like so (http://www.amazon.co.uk/gp/product/B000E6DYXA/ref=s9newrf_c2_img2-rfc_g1?pf_rd_m=A3P5ROKL5A1OLE&pf_rd_s=center-2&pf_rd_r=1QH9EC1CD9WWN5S6XKJB&pf_rd_t=101&pf_rd_p=139287591&pf_rd_i=468294).

Previously it worked both ways. Not that i'm complaining, though!

ArnyVee
08-22-2008, 01:05 AM
Is this mod still functioning alright for folks? Since there hadn't been a post in nearly three months, I wanted to ensure that everyone was okay before proceeding. :)

Dabbi
08-25-2008, 10:13 PM
Yes, FWIW this still seems to be working just fine on my board (3.7). :)

ArnyVee
08-29-2008, 11:07 AM
Does what it is meant to do on my boards as well (3.7.1)! :D

Hidden_Gamma
09-12-2008, 01:15 PM
I've just installed this on a 3.7.3 PL1 board and it is not adding my ID to any Amazon links. Is it supposed to work in that version of vBulletin?

TMR Bac
09-17-2008, 03:19 PM
I must be missing something here. What else do you had to do other than upload functions_amazon_links.php into the includes folder to get this to work?

pete_brady
09-24-2008, 08:19 PM
I've just installed this on a 3.7.3 PL1 board and it is not adding my ID to any Amazon links. Is it supposed to work in that version of vBulletin?

had been working great but has now stopped working for me, possibly since the 3.7.3 pl1 install

Hidden_Gamma
09-24-2008, 08:48 PM
had been working great but has now stopped working for me, possibly since the 3.7.3 pl1 install

I've just realised that it seems to not work on Amazon links that are already posted, for some reason, only on new ones added since I installed the plug-in. I have a thread with links to Blu-ray titles listed on Amazon and I had to go through the entire thread and re-edit the links to get the plug-in to add the affiliate tag to them when clicked on. The URL's are identical, but, there you have it. :confused:

Michael2
10-25-2008, 06:06 PM
Just added it and seems to work great, thanks!

wraggster
11-16-2008, 02:10 PM
i have this or one of the others installed on my forums and works great, sadly when i use vbexternal to pull the data from the forums into a newsfeed (so it shows up on my websites) it doesnt add my associate links, is there any code i can stick on my website or in the news.php which will change links to my associate link

dvsDave
11-26-2008, 03:05 AM
Works great on vBulletin 3.7.4 PL1 and VBSEO 3.2.0

just wanted to post a heads up on that and a thanks for the mod, works wonderfully!

heatherw610
12-09-2008, 12:29 AM
Does this work for 3.7.4?

Hidden_Gamma
12-25-2008, 02:39 AM
This doesn't seem to be working for me in 3.7.4, and I've tried the hack to get Amazon UK links added, and those won't work either. Maybe I'm doing something wrong? :confused: :o

rmd1
12-26-2008, 01:06 PM
Hey, I installed the script and its working so far... but when editing a post and clicking on the submit button it turns into the loading symbol for infinite time... but the post already got edited. I contacted the the vB support and they told me its because of this hack :(
Can somebody confirm that he is having the same problems? Or a fix for this? Please help, I need this working asap!

Regards,
rmd1

This doesn't seem to be working for me in 3.7.4, and I've tried the hack to get Amazon UK links added, and those won't work either. Maybe I'm doing something wrong? :confused: :o

try out the code that was posted a page ago. that one worked for me with co.uk

Hidden_Gamma
12-26-2008, 05:32 PM
try out the code that was posted a page ago. that one worked for me with co.uk

That's what I tried, but it doesn't work. In fact, nothing works. It just won't add the affiliate links to anything. :confused:

Ironduke
01-02-2009, 12:16 AM
I've uploaded the PHP file with my aStore ID written in, and uploaded the plugin. How do I get it to re-write the links to include my aStore ID?

Hidden_Gamma
01-11-2009, 09:30 PM
Okay, this wasn't working for me in 3.7.4 PL1, and now I've gone to 3.8.0 -- do I have any hope of getting it to work in that version? :(

Also, I have one further question about the hack on the last page to get it to work with Amazon.co.uk, what exactly do you mean by 'add the bit in the preg_match to work with this'? I'd like to give it one last go before I throw my hands up on this entirely. :o

ebed146
01-17-2009, 03:07 AM
Someone port this over to 3.8 please. It is a wonderful hack!

Claygp
01-22-2009, 03:49 AM
Are we going to see a 3.8 version??

veracity024
01-28-2009, 06:23 PM
the sooner the better for the 3.8 version!

Coop1979
02-07-2009, 03:16 AM
I just PM'd the coder. I offered financial compensation to update the mod, so hopefully that will help!

Hidden_Gamma
03-19-2009, 05:57 PM
I've got this working for .co.uk

You can easily add .ca, .de or any two level .tld like .co.uk to this by adding:
$associate_id_ and then the .tld with the . replaced by _
$associate_id_co_uk is the UK one.

And of course add the bit in the preg_match to work with this.

Code for the file is thus:

<?php
function amazon_links($text) {
$associate_id_co_uk = 'buro9-21'; // or leave empty
$associate_id_com = 'buro9-20'; // or leave empty

$replace_targt_urls = true; // true or false

$replace_src = array();
$replace_str = array();

// check for some text (amazon-link)
if(preg_match_all("/\+)?amazon\.(co\.uk|com)\/(?:.+))(?:\")?](.+)\[\/url\]/iU", $text, $out)) {
for($i=0;$i<count($out[1]);$i++) {
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
$out[4][$i] = $out[1][$i];

if($associate_id && !empty($associate_id)) {
// Look for an asin number
if(preg_match("/\/[A-Z0-9]{10}(\/)?/", $out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
if(substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
} else {
$target_url = $out[1][$i];
if($replace_targt_urls) {
$target_url = preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'ref='.$associate_id, $target_url);
$target_url = preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'tag='.$associate_id, $target_url);
}

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
}

$replace_src[] = '';
$replace_str[] = '[url="'.$out[1][$i].'"]';

$replace_src[] = '[url='.$out[4][$i].']';
$replace_str[] = '[url='.$out[1][$i].']';

$replace_src[] = '[url="'.$out[4][$i].'"]';
$replace_str[] = '[url="'.$out[1][$i].'"]';

$replace_src[] = '[url='.$out[4][$i].']';
$replace_str[] = '[url='.$out[1][$i].']';
}
}
} unset($out);

// check for [url]amazon-link ('.$out[4][$i].')
if(preg_match_all("/\[url\](http:\/\/(?:[A-z0-9\.]+)?amazon\.(co\.uk|com)\/(?:.+))\[\/url\]/iU", $text, $out)) {
for($i=0;$i<count($out[1]);$i++) {
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
$out[4][$i] = $out[1][$i];

if($associate_id && !empty($associate_id)) {
// Look for an asin number
if(preg_match("/\/[A-Z0-9]{10}(\/)?/", $out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
if(substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
} else {
$target_url = $out[1][$i];
if($replace_targt_urls) {
$target_url = preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'ref='.$associate_id, $target_url);
$target_url = preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'tag='.$associate_id, $target_url);
}

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
}

$displayed_link = $out[4][$i];
if(strlen($displayed_link) > 55) {
$displayed_link = substr($displayed_link, 0, 36).'...'.substr($displayed_link, -14);
}


$replace_src[] = '[url]'.$out[4][$i].'';
$replace_str[] = ''.$displayed_link." ('.$out[1][$i].')";

$replace_src[] = ''.$out[4][$i].'';
$replace_str[] = ''.$displayed_link." ('.$out[1][$i].')";
}
}
} unset($out);


// replace the message
if(isset($replace_src[0])) {
$text = str_replace($replace_src, $replace_str, $text);
} unset($replace_src, $replace_str);

return $text;
}
?>
Thanks for the great hack.


Can someone tell me what exactly I am supposed to write into the preg_match section to get this hack to work for my multilevel domain affiliate links if I am using more than one? I have affiliate IDs for .co.uk and .co.jp, but I don't really understand how to write in more than one according to this example, I also can't seem to figure out where I am supposed to put my .de domain in the preg_match section.

Also, I seemed to have discoveed that on my forum (running 3.8.1 PL1) that this plugin will only add the affiliate ID to URLs if they are added raw, but if an Amazon URL is added to text, like this, for example: I Love Lucy (http://www.amazon.com/gp/product/B000TGJ8B2/ref=s9_sdps_c2_s3_p74_i1?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=16ZRZNNZGJZHF9ENW0XG&pf_rd_t=101&pf_rd_p=470938631&pf_rd_i=507846), it won't add the Afilliate ID.

Thanks for any help. I really hope this plugin can be updated.

buro9
03-19-2009, 06:13 PM
BTW. If anyone is using AME and has the definition file... whoever submitted the Amazon re-write for that is hijacking your affiliate earnings.

Hidden_Gamma
03-20-2009, 03:43 AM
BTW. If anyone is using AME and has the definition file... whoever submitted the Amazon re-write for that is hijacking your affiliate earnings.


What's AME?

buro9
03-20-2009, 05:17 AM
What's AME?
https://vborg.vbsupport.ru/showthread.php?t=202476

And these are the definitions:
https://vborg.vbsupport.ru/showthread.php?t=195884

And someone with an Amazon affiliate of "citofgamonlco-20" is hijacking the earnings.

And you can see that here from the number of vBulletins he is earning from:
http://www.google.co.uk/search?q=citofgamonlco-20

Hidden_Gamma
03-20-2009, 02:35 PM
https://vborg.vbsupport.ru/showthread.php?t=202476

And these are the definitions:
https://vborg.vbsupport.ru/showthread.php?t=195884

And someone with an Amazon affiliate of "citofgamonlco-20" is hijacking the earnings.

And you can see that here from the number of vBulletins he is earning from:
http://www.google.co.uk/search?q=citofgamonlco-20

Oh, what a jackass. I hope he has been reported to Amazon and whatever other authorities handle that sort of thing. :mad: :erm:

Hidden_Gamma
03-20-2009, 09:30 PM
Okay, I have this working, somewhat, under 3.8.1 PL1 using the hack to get multi-level domains, but the problem is, it is adding my affiliate IDs to all the URLs other than my my two multilevel domain affiliate IDs for Amazon UK and Amazon Japan.

I think it may have something to do with the preg_match section, which I keep trying to tweak to get working, but to no avail. Maybe someone here can help me out? Here's the code as I am using, with my affiliate IDs redacted:

<?php
function amazon_links($text) {

/*
* your partnernet ids
*/
$associate_id_co_uk = 'azn-id'; // or leave empty
$associate_id_co_jp = 'azn-id'; // or leave empty
$associate_id_de = 'azn-id'; // or leave empty
$associate_id_com = 'azn-id'; // or leave empty
$associate_id_ca = 'azn-id'; // or leave empty

/*
* tag=xxx and ref=xxx will be replaced with your associate id in non asin links
*/
$replace_targt_urls = true; // true or false
// reeplace arrays
$replace_src = array();
$replace_str = array();

// check for some text (amazon-link)
if(preg_match_all("/\+)?amazon\.(co\.uk|co\.jp|de|com|ca)\/(?:.+))(?:\")?](.+)\[\/url\]/iU", $text, $out)) {
for($i=0;$i<count($out[1]);$i++) {
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
$out[4][$i] = $out[1][$i];

if($associate_id && !empty($associate_id)) {
// Look for an asin number
if(preg_match("/\/[A-Z0-9]{10}(\/)?/", $out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
if(substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
} else {
$target_url = $out[1][$i];
if($replace_targt_urls) {
$target_url = preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'ref='.$associate_id, $target_url);
$target_url = preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'tag='.$associate_id, $target_url);
}

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
}

$replace_src[] = '';
$replace_str[] = '[url="'.$out[1][$i].'"]';

$replace_src[] = '[url='.$out[4][$i].']';
$replace_str[] = '[url='.$out[1][$i].']';

$replace_src[] = '[url="'.$out[4][$i].'"]';
$replace_str[] = '[url="'.$out[1][$i].'"]';

$replace_src[] = '[url='.$out[4][$i].']';
$replace_str[] = '[url='.$out[1][$i].']';
}
}
} unset($out);

// check for [url]amazon-link ('.$out[4][$i].')
if(preg_match_all("/\[url\](http:\/\/(?:[A-z0-9\.]+)?amazon\.(co\.uk|co\.jp|de|com|ca)\/(?:.+))\[\/url\]/iU", $text, $out)) {
for($i=0;$i<count($out[1]);$i++) {
$associate_id = ${'associate_id_'.str_replace('.','_',$out[2][$i])};
$out[4][$i] = $out[1][$i];

if($associate_id && !empty($associate_id)) {
// Look for an asin number
if(preg_match("/\/[A-Z0-9]{10}(\/)?/", $out[1][$i], $asin) && strpos($out[1][$i], '/review') === false) {
if(substr($asin[0], -1) != '/') { $asin[0] .= '/'; }
$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;
} else {
$target_url = $out[1][$i];
if($replace_targt_urls) {
$target_url = preg_replace('/ref\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'ref='.$associate_id, $target_url);
$target_url = preg_replace('/tag\=([a-z0-9\-]{3,})\-([0-9]{2})/iU', 'tag='.$associate_id, $target_url);
}

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/redirect?link_code=ur2&camp=1789&tag='.$associate_id.'&creative=9325&path='.urlencode($target_url);
}

$displayed_link = $out[4][$i];
if(strlen($displayed_link) > 55) {
$displayed_link = substr($displayed_link, 0, 36).'...'.substr($displayed_link, -14);
}


$replace_src[] = '[url]'.$out[4][$i].'';
$replace_str[] = ''.$displayed_link." ('.$out[1][$i].')";

$replace_src[] = ''.$out[4][$i].'';
$replace_str[] = ''.$displayed_link." ('.$out[1][$i].')";
}
}
} unset($out);


// replace the message
if(isset($replace_src[0])) {
$text = str_replace($replace_src, $replace_str, $text);
} unset($replace_src, $replace_str);

return $text;
}
?>

Hidden_Gamma
03-20-2009, 10:04 PM
And now I'm getting this error message:

Unable to add cookies, header already sent.
File: /home/bluray/public_html/forum/includes/functions_amazon_links.php
Line: 101Okay, never mind, this error is fixed, but the piece of code above is working for everything, including embedded links, except for the multi-level .co.uk and .co.jp domains, which I can't seem to get to work no matter what I do.

Hidden_Gamma
03-23-2009, 11:04 PM
One more update, this plugin also won't work on URLs in the Calendar. So, to sum up, it won't work for the multi-level .uk and .jp domains, and it won't add the affiliate ID's to URLs posted in the Calendar -- that's where I'm at with this on a 3.8.1 PL1 board using the hack for mutli-level domains.

RedWingFan
06-02-2009, 05:11 AM
Can't get it to work on 3.7.2. The preg_match looks for the ASIN number, correct? If so, then the format of Amazon's link shouldn't matter, if the ASIN appears as below:

http://www.amazon.com/No-Line-Horizon-U2/dp/B001O0EQ5U/ref=sr_1_1?ie=UTF8&s=music&qid=1243921433&sr=1-1

Hidden_Gamma
06-02-2009, 01:46 PM
I now have 3.8.2 installed and the status is still the same for me with this plugin -- it won't work for .uk and .jp multilevel domains or in te VB calendar.

RedWingFan
06-02-2009, 08:46 PM
For now, I've disabled the plugin. When I get time, I may dissect the function and toss out some variables to see how it is working.

(EDIT: Disregard the following...my error...) For the .co.uk and .co.jp domains, I need those as well. I know that the regex for (co\.uk|co\.jp|de|com|ca) should work (syntax looks correct, and the dots are escaped properly), but I wonder how the script is parsing the $associate_id_co_uk and $associate_id_co_jp variable names, as they have one extra set of underscore and characters than the others. I wonder if that's where the problem lies...? That's why I want to look into the function more to see how it is setting the variables, if only for me to understand how it works overall. It's the regular expressions I sometimes get hung up on.

RedWingFan
06-04-2009, 07:34 PM
Never mind that last bit above--I am now using the modified version of the plugin's PHP file above (post #85 by Hidden Gamma), and I see the modified lines. (I had manually made changes, but missed two lines.) So the regex is fine as is.

Nonetheless, I ran the plugin as a regular PHP file (removed the function syntax), assigned $text manually, and found out that the plugin's PHP file is rewriting the URL correctly, with our associate ID in it. So, the problem does not appear to be with the functions_amazon_links.php file.

And those with .co.jp and .co.uk should be happy to know that those URLs are rewriting properly as well (the domains show up properly).

So for some reason, the rewritten code is not making it to the posts, either when made as a new thread, a normal reply, or a quick reply.

Someone with access to a web server can test this themselves also. Comment out this line at the top of the file:

// function amazon_links($text) {

Right below it, use something like this:

$text = "Click Here (\"http://www.amazon.co.uk/No-Line-Horizon-U2/dp/B001O0EQ5U/ref=sr_1_1?ie=UTF8&s=music&qid=1243921433&sr=1-1\")";

At the bottom of the file, comment out these two lines:

// return $text;
// }

...and add this line below it:

print $text;

Run this file in the browser, and you'll see the output with the correct country's associate ID inserted, and the correct domains in the URL.

So my hiccup has to do with the hook location...? Or the PHP code that calls the plugin? This plugin file works, but changes don't end up in the finished post. Once I solve that, I'm golden.

One added bonus: we have one or two members who "innocently" :rolleyes: post Amazon links to a CD, with their own Associates ID inserted in the URL. This will kill that, and save my staff having to sniff these out.

SirHappy
06-20-2009, 03:16 PM
thx. works in 3.8.3.

jca2112
07-31-2009, 06:57 PM
This doesn't work for me in vB 3.8.3.

Any help updating this for 3.8.3 (and adding support for sites like Amazon.co.uk) is appreciated.

meeja
08-31-2009, 10:24 AM
Does this mod work for 3.8.4?

derrene
12-13-2009, 04:55 PM
Does this mod work for 3.8.4?

work

RedWingFan
12-13-2009, 10:23 PM
I haven't gotten it to work in ANY version.

Uninstalled.

Phillip Chapman
01-01-2010, 06:34 PM
Does anyone know if this mod will work in vB 4.0 or will it need to be updated for the new version? Thanks in advance.

Claygp
01-14-2010, 11:31 PM
Does anyone know if this mod will work in vB 4.0 or will it need to be updated for the new version? Thanks in advance.

Works perfect for me on 4.0.1 after the upgrade from 3.8.4. I didn't even have to disable it or enable it or anything. :D

derrene
03-06-2010, 08:24 AM
4.0.2 works too

drudge99
08-12-2010, 04:44 PM
Does anyone have this installed with 4.0.6?

ShackMaster
08-16-2010, 03:57 PM
This appears to be working good for us thus far on version 3.8.5... with the co.uk modification.

New links to Amazon.com, Amazon.ca and Amazon.co.uk are rewriting with our associate ID, but old links are not. In order for old links to work, we are having to edit and save with no actual edit being made.

Of course this is our initial findings... and we will have to verify that there are no other conflicts.

twistedsymphony
09-23-2010, 04:44 PM
I just got this installed and running on 3.8.x and it seems to work great :)

one concern though... I'm new to the whole affiliate linking thing and I noticed it's adding "ref=nosim" to some of the links.

I didn't know what this was so I looked it up, people used to add it because it would take users directly to the desired products as opposed to a similar product's page.

Amazon has depreciated this tag a few years ago (hence why I'd never seen it) and they state that link that include it should still work but they don't recommend anyone use it anymore.

there is concern among some that the "ref=nosim" tag will at some point stop working and invalidate existing links.

it'd be nice if there were an updated version of this plugin that takes newer link protocol into account... or if someone with a good knowledge of amazon affiliate links could point out what needs to be changed in the code to get rid of that tag.

it looks like it's used in 2 places with the following line:

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref=nosim/'.$associate_id;

I'm curious if it should be modified to this:

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'ref='.$associate_id;

or to this:

$out[1][$i] = 'http://www.amazon.'.$out[2][$i].'/exec/obidos/ASIN'.$asin[0].'/'.$associate_id;

hqarrse
10-22-2010, 11:36 AM
Version 4.0.8 has caused me some problems (this is my first try so I don't know if it worked in previous versions of VB4).

Firstly I had to manually create the plugin - the XML upload throws an error. This was no problem - just look at the XML file and it is very obvious what to enter when you do 'Add new plugin'. However....

The function only worked for a new post. I believe this is to do with cache. Therefore after this initial posting is made, this line in the plugin no longer does anything:


$post['pagetext'] = amazon_links($post['pagetext']);


My solution - I'm sure not the ideal one, is to scrap the plugin and edit the file showthread.php as follows:

after line 113 add the include

require_once(DIR . '/includes/functions_amazon_links.php');


after line 980, in the loop for the large query that reads the post table:


$post['pagetext'] = amazon_links($post['pagetext']);


and then after 1469 when the post cache is being read


$post['pagetext'] = amazon_links($post['pagetext']);


Secondly the regex seems to be case sensitive when searching for URL, despite the /i at the end. Therefore as given it will not find URL= and (sod's law) the post I was testing on had it in upper case. I assume the user typed it in manually. I haven't been able to fix that yet, hence this post. Can a regex expert please help and make the function search for both URL and url?

Claygp
11-21-2010, 03:12 PM
Can we please get an updated version of this for 4.0.8? Mine stopped working with the upgrade. :(

raaowdot
11-30-2010, 01:30 PM
Does anyone know how to adapt it for amazon.co.uk?

I've tried to amended the codes from com to co.uk however I'm not able to do this with the variable. Any ideas?

mulesnx
12-07-2010, 06:55 PM
When I add a link, it truncates the amazon link but does not add affiliate code. I am using 3.6.7

wraggster
02-02-2011, 02:28 PM
any chance of a vb4 version ?

lubbie
03-09-2011, 04:50 PM
Same here. Appreciate an update to vb4

wraggster
03-22-2011, 01:53 PM
This appears to be working good for us thus far on version 3.8.5... with the co.uk modification.

New links to Amazon.com, Amazon.ca and Amazon.co.uk are rewriting with our associate ID, but old links are not. In order for old links to work, we are having to edit and save with no actual edit being made.

Of course this is our initial findings... and we will have to verify that there are no other conflicts.

do you have the full code of this working, i still cantget .com and .co.uk to work together

hiker
05-13-2011, 07:47 PM
Same here. Appreciate an update to vb4

ditto

imahawki
08-06-2011, 11:13 PM
Ditto. Used this before but now I'm on vB 4.x and it doesn't work. The alternatives are crap, they require you to register with a 3rd party service and funnel your traffic through them. I don't NEED that, I just need a link reformatted!

Artes_Marciales
10-17-2011, 12:18 PM
Work for amazon.es?

zippokid
01-22-2012, 04:00 AM
Ditto. Used this before but now I'm on vB 4.x and it doesn't work. The alternatives are crap, they require you to register with a 3rd party service and funnel your traffic through them. I don't NEED that, I just need a link reformatted!
agreed, would love to have a rewrite!

insidegames
05-04-2012, 03:41 PM
would this also work with amazon.co.uk?

brandon515
06-25-2012, 05:46 PM
Looking for VB4 version...anyone?

jderouen
06-30-2012, 03:51 PM
I can't get it to work with Amazon.co.uk either.

djbaxter
06-30-2012, 04:17 PM
You don't need a vB4 version. I've had this working from 3.x through 4.0 to 4.2.0 PL2.

singabaloo
08-28-2012, 09:40 AM
Has anyone tried this with amazon.co.jp ?

englishtalk
09-07-2012, 12:46 PM
tried to add this to 4.1.7 and the product uploader thinks this is a plugin not a product. What to do?

cisoprogressivo
10-12-2012, 04:55 PM
I can't make it work for amazon.it (vb4).

Vcize
11-09-2012, 05:42 AM
I installed this on my vb3.8 board and it doesn't appear to be doing anything. I don't see my affiliate ID in the URL or anything.

djbaxter
11-09-2012, 03:41 PM
Did you edit the plugin to add your affiliate ID for the correct version of Amazon?

Vcize
11-09-2012, 06:48 PM
Did you edit the plugin to add your affiliate ID for the correct version of Amazon?

I edited lines 6 and 7 of functions_amazon_links.php with my affiliate ID (xxxxx-20).

cs28702
11-23-2012, 02:08 AM
is there something like this for vb4.2?

djbaxter
11-23-2012, 03:46 AM
It works for 4.2

cs28702
11-23-2012, 03:52 AM
when I tried to upload it , it gave me a message about it being a plugin, not a product. I go to the plugin manager, there is no place to upload the import the xml file

cs28702
11-23-2012, 03:55 AM
nevermind, just tried the upload/download plugins... thanks

cs28702
11-23-2012, 04:18 AM
I just got it working, but it's using "ref=nosim" and from what I've googled those are no longer used

djbaxter
11-23-2012, 01:41 PM
I just got it working, but it's using "ref=nosim" and from what I've googled those are no longer used

They still work just fine.

pingso
12-04-2012, 09:42 PM
They still work just fine.

how can "ref=nosim" be removed ?

djbaxter
12-04-2012, 11:03 PM
how can "ref=nosim" be removed ?

You don't need to remove it. It works fine with it in the link or not in the link. Amazon doesn't care.

I've got several links on various sites that contain "ref=nosim". They take the visitor to the correct page and I get credit for any purchases resulting from that click.

Majora
04-12-2013, 09:10 PM
Is the following amazon affiliate link correct?
http://www.amazon.de/exec/obidos/ASIN/B006YTF2OU/ref=nosim/wwwipadteamde-21

metrika
07-28-2013, 08:34 AM
Can it be adapted to work with amazon.(whatever) ?

abcsplus
09-29-2013, 04:55 AM
Nope, not working with 4.2.1 Are there any other scripts out there?

Dabbi
09-29-2013, 12:13 PM
I'd really like to see this and the ebay one for 4.2.1 as well please. It worked so well for us before the upgrade.

StarBuG
03-11-2014, 04:27 PM
I use it on 4.2.1 and it works.
No changes needed except adding the ID.

It only changes the URLs on the fly so if you edit the text you wont see your affiliate id in the link.

tpearl5
10-02-2014, 03:11 PM
FYI, making a mod like this to work with 4.2.2 and dynamically update Amazon links based on specific criteria.

Also, the links that are rewritten via this mod are dated and not using the current format.