Originally Posted by
Shawn
Regarding, your first method:
Did you set the referrer url for the item purchase link?
I don't have access to my usershop buyer script right now but i believe you need to set the referrer url for your request.
Just go make a legit purchase from a usershop and log that request and look at the referrer url.
Originally Posted by
j03
Typically, this error comes up when you are not sending the correct referrer.
Great, so I gave your advice a try. I'm doing a fetch on this
Code:
https://www.neopets.com/buy_item.phtml?lower=0&owner=dpfort&obj_info_id=77146&g=1&xhs=65s049os&old_price=1&feat=77146,1,1&_ref_ck=5434a7d089f0dcf6462fd912dc28b809
With the referrer set as
Code:
https://www.neopets.com//browseshop.phtml?owner=dpfort&buy_obj_info_id=77146&buy_cost_neopoints=1
The code looks like
Code:
fetch(url, {
referrer: refer,
})
.then(response => {
// Check if the response is successful
if (!response.ok) {
throw new Error('Network response was not ok');
}
// Parse the response as text
console.log("response.text()",response.text());
return response.text();
})
And the response is the same error response. I'm trying to copy this network log from a real purchase
Code:
https://www.neopets.com/buy_item.phtml?lower=0&owner=missmessye&obj_info_id=77146&g=1&xhs=65s03n2p&old_price=2&feat=77146,2,1&_ref_ck=5434a7d089f0dcf6462fd912dc28b809
Request Method:
GET
Status Code:
302 Found
Remote Address:
23.205.106.160:443
Referrer Policy:
strict-origin-when-cross-origin
https://www.neopets.com/browseshop.phtml?owner=missmessye&buy_obj_info_id=77146&buy_cost_neopoints=2
Sec-Ch-Ua:
"Chromium";v="122", "Not(A:Brand";v="24", "Brave";v="122"
---------- Post added at 06:58 AM ---------- Previous post was at 06:33 AM ----------
The network log has these interactions
Code:
fetch("https://www.neopets.com/buy_item.phtml?lower=0&owner=dpfort&obj_info_id=77146&g=1&xhs=65s04r6q&old_price=1&feat=77146,1,1&_ref_ck=5434a7d089f0dcf6462fd912dc28b809", {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Brave\";v=\"122\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"sec-fetch-user": "?1",
"sec-gpc": "1",
"upgrade-insecure-requests": "1"
},
"referrer": "https://www.neopets.com/browseshop.phtml?owner=dpfort&buy_obj_info_id=77146&buy_cost_neopoints=1",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
});
fetch("https://www.neopets.com/browseshop.phtml?owner=dpfort&buy_obj_info_id=77146&buy_cost_neopoints=1&lower=0", {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Brave\";v=\"122\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"sec-fetch-user": "?1",
"sec-gpc": "1",
"upgrade-insecure-requests": "1"
},
"referrer": "https://www.neopets.com/browseshop.phtml?owner=dpfort&buy_obj_info_id=77146&buy_cost_neopoints=1",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
});
So now I'm doing things that I have no clue if it's right or not haha. This code does not work
Code:
// Fetch request to buy the item
fetch(url, {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Brave\";v=\"122\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"sec-fetch-user": "?1",
"sec-gpc": "1",
"upgrade-insecure-requests": "1"
},
"referrer": refer,
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
}).then(response => {
// Handle the response
// Check if the response is successful
if (!response.ok) {
throw new Error('Network response was not ok');
}
// Parse the response as text
console.log("response.text()",response.text());
//return response.text();
}).catch(error => {
console.error('Error:', error);
});
// Fetch request to browse the shop
console.log("link + &lower=0",refer + "&lower=0");
fetch(link + "&lower=0", {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Brave\";v=\"122\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"sec-fetch-user": "?1",
"sec-gpc": "1",
"upgrade-insecure-requests": "1"
},
"referrer": refer,
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
}).then(response => {
// Handle the response
}).catch(error => {
console.error('Error:', error);
});