Syntax
url=amazoncode2link([code,ext])
Input Parameter
code : | | 10 alphanumerical char code of amazon |
ext : | | default is 'de'; but can be used to open other contries too |
Output Parameter
url : | | url to use as web(url) |
Examples
amazoncode2link('B01LCXPGXE')
amazoncode2link('B077ZWB9CP','com')
Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, amazoncode2link
, is designed to generate a valid Amazon product URL from a given 10-digit alphanumeric code. It can also open the product page in a web browser. The function is part of the SG-Library and was introduced in SolidGeometry 5.0.
Input Parameters
- code: A 10-character alphanumeric string representing the Amazon product code.
- ext: A string representing the country-specific Amazon domain extension. The default is 'de' for Germany, but it can be changed to other country codes like 'com' for the USA.
Output
- url: A string containing the complete URL to the Amazon product page, which can be used with the
web(url)
function to open the page in a browser.
Algorithm Steps
- Retrieve the
code
parameter using getfuncparams
with a default empty string.
- Retrieve the
ext
parameter using getfuncparams
with a default value of 'de'.
- Check if
code
is empty. If it is, throw an error indicating the code is not valid and provide an example of a valid code.
- Construct the URL using the format
'https://www.amazon.' + ext + '/dp/' + code
.
- If no output argument is specified (
nargout==0
), open the constructed URL in the default web browser using the web(url)
function.
Example Usage
amazoncode2link('B01LCXPGXE')
- Generates and opens the URL for the product with code 'B01LCXPGXE' on the German Amazon site.
amazoncode2link('B077ZWB9CP','com')
- Generates and opens the URL for the product with code 'B077ZWB9CP' on the US Amazon site.
Algorithm explaination created using ChatGPT on 2025-08-19 07:30. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21