csgo-trader-extension
csgo-trader-extension copied to clipboard
cs.money screenshoting and 3D inspect
Check if its possible to request screenshots and 3D inspect from cs.money without visiting the site and owning the item. Add it to the extension.
I went back and forth a bit, and based on the POST request from cs.money to cs.money/generate_screenshot i was able to reverse engineer the post request, so basically all the information /generate_screenshot requires is 1. an inspect link attached as a json body 2. a cookie containing a var called csgo_ses and steamid, i have tested it a bit and it seems that even after recreating my sessions on cs.money the following variables {"csgo_ses":"e2b82703525de8b751c7e132d3b41bcd05fe5cfc8767aee0078701d1c086fc8d", "steamid":"76561198428292331"} seems to still work, i am assuming the steamid can be changed to whatever but i need to confirm that. The request returns an id which can be added to the base links of cs.money's screenshot service.
Short snippet to demonstrate the principles in python3 (Using the third-party extension requests)
import requests
insp = "steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198428292331A16376533832D5388044860375221111"
url = "https://cs.money/generate_screenshot"
def get_screen_id(inspect_link):
r = requests.post(url, json={"inspect_link":inspect_link}, cookies={"csgo_ses":"e2b82703525de8b751c7e132d3b41bcd05fe5cfc8767aee0078701d1c086fc8d", "steamid":"76561198428292331"})
return r.text
def get_screen_links(csm_id):
link2d = "https://s.cs.money/{}_image.jpg".format(csm_id)
link3d = "https://3d.cs.money/?q={}".format(csm_id)
return {"2d":link2d,"3d":link3d}
@cjavad This request returns "19 sign via steam" for me, but I will poke around later. It would still mean users having to update their csmoney cookies in the extension for this to work I believe, so the user experience would be degraded. The extension could be modified to run on cs.money as well and update the cookies when/if they are changed. In my experience cs.money logs you out every 24 hours.
Upon further inspection, when switching my internet connection or changing my ip, the response indeed becomes "19 sign via steam".
Edit: It might be possible to automatically fetch the cookies, so the user only simply has to login into cs.money once.
As I said fetching the cookies should be possible by giving the extension permission to run on cs.money, however the site would have to be open all the time and users would have to reauthenticate with cs.money daily. I don't think we can achieve good enough UX so I am putting this aside again. Thanks for the investigation and your findings.
I re-ran the same script today with the same variables as previous with new unregistered inspect links, and it returned correct results every time. The cookie returned has a 1 year expiration date (Tue, 04 Aug 2020 14:26:43 GMT). Based on this it seems that one authentication is enough for a longer period of time.
That would be nice, if I log out of csmoney it returns the sign in thing again though. I will log back in and check if it works tomorrow when it logs me out automatically.
I either forgot to check it when it logged me out or it did not log me out. Anyway, the same thing that worked two days ago does not work right now, unfortunate.
If you are still interested in a similar feature for this, I can make a PR to support swap.gg their screenshot API.
@Heartz66 Hi, that could be great actually! I did not know they have one. cs.deals' service has been under maintenance for god knows how long. I started giving up on it.
I have just published a pull request for this improvement: https://github.com/gergelyszabo94/csgo-trader-extension/pull/354
@Heartz66 I merged it to master, the next public version will include it. Thanks for the contribution!