steamutils 1.0.68 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/SteamClient.js +9 -14
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -836,20 +836,25 @@ function SteamClient({
836
836
  return false
837
837
  }
838
838
 
839
- async function getNewCookie(cookie) {
839
+ async function _getStoreSteamPoweredResponse(cookie) {
840
840
  let response = null
841
- for (let i = 0; i < 10; i++) {
841
+ for (let i = 0; i < 20; i++) {
842
842
  if(!response){
843
843
  try {
844
844
  response = (await axios.request({
845
845
  url: 'https://store.steampowered.com/', headers: {
846
846
  cookie,
847
- accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
847
+ accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.75',
848
848
  },
849
849
  }))
850
850
  } catch (e) { }
851
851
  }
852
852
  }
853
+ return response
854
+ }
855
+
856
+ async function getNewCookie(cookie) {
857
+ let response = await _getStoreSteamPoweredResponse(cookie)
853
858
  if(!response){
854
859
  return
855
860
  }
@@ -864,17 +869,7 @@ function SteamClient({
864
869
  cookieObj[name] = value
865
870
  }
866
871
  cookie = Object.keys(cookieObj).map(name => `${name}=${cookieObj[name]}`).join(';')
867
- for (let i = 0; i < 10; i++) {
868
- try {
869
- response = (await axios.request({
870
- url: 'https://store.steampowered.com/', headers: {
871
- cookie,
872
- accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
873
- },
874
- }))
875
- break
876
- } catch (e) { }
877
- }
872
+ response = await _getStoreSteamPoweredResponse(cookie)
878
873
  }
879
874
  return cookie
880
875
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",