• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Amazon Parser

Amazon Parser 3.5

No permission to download
Adds Amazon affiliate ID to links in messages.

AndyB

Well-known member
#1
AndyB submitted a new resource:

Amazon Parser - Adds your Amazon Affiliate ID to URLs contained in messages.

Description:

The Amazon Parser add-on is designed to add your Amazon Affiliate ID to URLs contained in messages.

(Example of options page)

View attachment 67793

Features:
  • Different affiliate IDs can be added for each of the six countries served by Amazon
  • Adds affiliate ID to URLs with an ASIN
  • Adds affiliate ID to URLs with /review in URL
  • Deletes any existing affiliate IDs and adds your affiliate ID
How it works:

A member pastes one or...
Read more about this resource...
 

Andy.N

Well-known member
#7
@AndyB
Thanks for the addon. This is something I have been looking forward to to replace the current URLrewriter addon that has not been updated for ages.
After installing it, add my .com affiliate ID, and go back to on my previous threads that have amazon links, it does not seem to work.
1) it only seems to work on new posts.
2) If I add http://www.amazon.com/gp/product/0979757622 to the post, it will chance to http://www.amazon.com/gp/product/0979757622/?tag=affiliate-ID.

I think it would be better if the affiliate id is hidden using [url=http://www.amazon.com/gp/product/0979757622/?tag=affiliate-ID]http://www.amazon.com/gp/product/0979757622[/url]
3) Also, turning on the Link Proxy will not result in any link clicking being logged.
 

dvsDave

Well-known member
#8
Oh man, I thought this would re-parse on the fly. Shoot. Can I run a command to have it go through all the existing amazon links?
 

AndyB

Well-known member
#9
I've already written the Amazon Parser All add-on which will be used to update all posts. Currently it's being tested and I hope to release it in a day or two.
 

Adam Howard

Well-known member
#10
Error Info
PHP:
ErrorException: Fatal Error: Cannot redeclare amazon_links() (previously declared in /home/www/public_html/forums/library/Andy/AmazonParser/DataWriter/DiscussionMessage/Post.php:14) - library/Andy/AmazonParser/DataWriter/DiscussionMessage/Post.php:14
Generated By: Adam, A moment ago
Stack Trace
PHP:
#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}
Request State

PHP:
array(3) {
  ["url"] => string(81) "http://www.sociallyuncensored.eu/forums/threads/link-test-preview.18449/add-reply"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(10) {
    ["message_html"] => string(26) "<p>anonymous reply<br></p>"
    ["_xfRelativeResolver"] => string(72) "http://www.sociallyuncensored.eu/forums/threads/link-test-preview.18449/"
    ["anonymous_posting"] => string(32) "aed4338e8fbbf65c27e32c1deddf0727"
    ["attachment_hash"] => string(32) "db094178bb77ab9392ae6d14252f3497"
    ["last_date"] => string(10) "1393365090"
    ["last_known_date"] => string(10) "1393365090"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(40) "/forums/threads/link-test-preview.18449/"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
The error only seems to happen when you try to post "anonymously" using @xfrocks add-on and only on replies, not making a new thread.
http://xenforo.com/community/resources/bd-anonymous-posting.970/
 

Andy.N

Well-known member
#13
If you write My Amazon Link the affiliate_id is hidden after save this post. If you write http://www.amazon.com/gp/product/0979757622 the affiliate_id is not hidden. That is like XF works ...
I've been using this addon http://xenforo.com/community/threads/urlrewriter-auto-media-embed-and-affiliate-schemes.8292/

When you enter http://www.amazon.com/gp/product/0979757622 it will keep that format but when you click on it, it will go to http://www.amazon.com/gp/product/0979757622/?tag=id
 

Daniel Hood

Well-known member
#17
Oh man, I thought this would re-parse on the fly. Shoot. Can I run a command to have it go through all the existing amazon links?
I've already written the Amazon Parser All add-on which will be used to update all posts. Currently it's being tested and I hope to release it in a day or two.
I'm a little curious as to why you're doing it through datawriter instead of on the fly also. I would recommend applying the same concept through XenForo_BbCode_Formatter_Base instead of the datawriter. This would not only allow you to change the affiliate id at any point without updating every post but also allow it to apply to other content types instead of just posts.

[Edit] matter of fact, I think the perfect place to implement this code would be through: XenForo_BbCode_Formatter_Base::renderTagUrl(). I think it would improve this add on greatly if you switched to this method. You also don't run the risk of corrupting old messages. And your add on can be disabled at any point and the old links reverted back to how they were.

Just something for you to consider.