Last active
February 23, 2024 15:04
-
-
Save mjsir911/a3bc9bb23775158e240dc56a9717f9f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function firefox2cookiejar() { | |
# http://fileformats.archiveteam.org/wiki/Netscape_cookies.txt | |
# https://www.codejam.info/2021/10/bypass-sqlite-exclusive-lock.html | |
sqlite3 -separator ' ' "file:$1?immutable=1" <<- EOF | |
.mode tabs | |
.header off | |
select host, | |
case substr(host,1,1)='.' when 0 then 'FALSE' else 'TRUE' end, | |
path, | |
case isSecure when 0 then 'FALSE' else 'TRUE' end, | |
expiry, | |
name, | |
value | |
from moz_cookies; | |
EOF | |
} | |
# firefox2cookiejar ~/.mozilla/firefox/qti9o133.default-esr/cookies.sqlite | grep .amazon.com > cookie-jar.txt | |
function get_cookie() { | |
awk -F'\t' -v cookie="$1" '{if ($6==cookie) {print $7}}' | |
} | |
# https://stackoverflow.com/questions/42963395/bash-assign-variable-from-pipe | |
shopt -s lastpipe # weh | |
curl 'https://horizonte.browserapps.amazon.com/wishlist/tokens' -b cookie-jar.txt \ | |
| jq -r '[.token,.sessionTag] | join(" ")' | read -r "TOKEN" "SESSIONTAG" | |
curl 'https://horizonte.browserapps.amazon.com/wishlist/dialogbox' -b cookie-jar.txt \ | |
-b cookie-jar.txt \ | |
--data storageKey=AAWishlistProcess12345 \ | |
--data t=$TOKEN \ | |
--data s=$SESSIONTAG \ | |
--data tag=amz-mkt-fox-us-20 \ | |
--data ascsubtag=1ba00-01000-org00-linux-dsk00-nomod-us000-aauwl-feature-home \ | |
--data baseUrl=www.amazon.com \ | |
--data ubpSandboxHandle=1 \ | |
--data cid=$(get_cookie x-main < cookie-jar.txt) \ | |
| xmllint - --html --xpath 'string(//div/@data-param)' 2> /dev/null \ | |
| jq -r '[.addItemSalt,.addItemToken] | join(" ")' | read -r "ADDITEMSALT" "ADDITEMTOKEN" | |
CID=$(get_cookie x-main < cookie-jar.txt) | |
DATA=$(jq -n \ | |
--arg CID "$CID" \ | |
--arg ADDITEMSALT "$ADDITEMSALT" \ | |
--arg ADDITEMTOKEN "$ADDITEMTOKEN" \ | |
'{ | |
"cid": $CID, | |
"comment": "", | |
"cu": "USD", | |
"dq": 1, | |
"iu": "https://cdn.shopify.com/s/files/1/2425/9991/products/1111_f420b51f-2f23-4765-9d7e-a976eb5471bb_1296x.png?v=1667406391", | |
"lId": "2KBOJ2TGFPGWG", | |
"lType": "AMAZON_LIST", | |
"price": "36.50", | |
"pu": "https://www.dogecore.com/collections/sad-fish-wizard/products/sad-fish-wizard-2", | |
"s": $ADDITEMSALT, | |
"t": $ADDITEMTOKEN, | |
"title": "sad fish wizard – dogecore" | |
}') | |
curl 'https://horizonte.browserapps.amazon.com/wishlist/addExternalItem' \ | |
-X POST \ | |
-H 'Content-Type: application/json' \ | |
-H 'Origin: https://horizonte.browserapps.amazon.com' \ | |
--data-raw "$DATA" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently https://horizonte.browserapps.amazon.com returns a web-page with image saying that it is "temporarily unavailable"
![Website temporarily unavailable](https://camo.githubusercontent.com/d8d1094a60bf0d341284a633031d2481b47474835b822c966737845b33247bed/68747470733a2f2f672d6563782e696d616765732d616d617a6f6e2e636f6d2f696d616765732f472f30312f776562736974652f6572726f72732f3530332f67656e657269632e706e67)