steamutils 1.2.41 → 1.2.43
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.
- package/index.js +50 -1
 - package/package.json +1 -1
 
    
        package/index.js
    CHANGED
    
    | 
         @@ -6041,7 +6041,11 @@ class SteamUser { 
     | 
|
| 
       6041 
6041 
     | 
    
         
             
                    amount: amount,
         
     | 
| 
       6042 
6042 
     | 
    
         
             
                    price: price,
         
     | 
| 
       6043 
6043 
     | 
    
         
             
                  },
         
     | 
| 
       6044 
     | 
    
         
            -
                  method: "POST"
         
     | 
| 
      
 6044 
     | 
    
         
            +
                  method: "POST",
         
     | 
| 
      
 6045 
     | 
    
         
            +
                  headers: {
         
     | 
| 
      
 6046 
     | 
    
         
            +
                    'content-type': 'application/x-www-form-urlencoded',
         
     | 
| 
      
 6047 
     | 
    
         
            +
                    Referer: `https://steamcommunity.com/profiles/${this.getSteamidUser()}/inventory/`
         
     | 
| 
      
 6048 
     | 
    
         
            +
                  },
         
     | 
| 
       6045 
6049 
     | 
    
         
             
                }))?.data
         
     | 
| 
       6046 
6050 
     | 
    
         | 
| 
       6047 
6051 
     | 
    
         
             
                return response
         
     | 
| 
         @@ -6054,6 +6058,51 @@ class SteamUser { 
     | 
|
| 
       6054 
6058 
     | 
    
         
             
                  "email_domain": "gmail.com"
         
     | 
| 
       6055 
6059 
     | 
    
         
             
                }
         
     | 
| 
       6056 
6060 
     | 
    
         
             
              }
         
     | 
| 
      
 6061 
     | 
    
         
            +
             
     | 
| 
      
 6062 
     | 
    
         
            +
              async removeListing(id) {
         
     | 
| 
      
 6063 
     | 
    
         
            +
                const response = (await this._httpRequestAjax({
         
     | 
| 
      
 6064 
     | 
    
         
            +
                  url: `market/removelisting/${id}`,
         
     | 
| 
      
 6065 
     | 
    
         
            +
                  method: "POST",
         
     | 
| 
      
 6066 
     | 
    
         
            +
                }))?.data
         
     | 
| 
      
 6067 
     | 
    
         
            +
                return response
         
     | 
| 
      
 6068 
     | 
    
         
            +
              }
         
     | 
| 
      
 6069 
     | 
    
         
            +
             
     | 
| 
      
 6070 
     | 
    
         
            +
              async getMyListings() {
         
     | 
| 
      
 6071 
     | 
    
         
            +
                const result = (await this._httpRequestAjax({
         
     | 
| 
      
 6072 
     | 
    
         
            +
                  url: `market/mylistings/render/?count=100`,
         
     | 
| 
      
 6073 
     | 
    
         
            +
                }))?.data
         
     | 
| 
      
 6074 
     | 
    
         
            +
                if (result?.success === true) {
         
     | 
| 
      
 6075 
     | 
    
         
            +
                  const $ = cherrio.load(result.results_html)
         
     | 
| 
      
 6076 
     | 
    
         
            +
                  const list = []
         
     | 
| 
      
 6077 
     | 
    
         
            +
                  $('.market_listing_row').each(function () {
         
     | 
| 
      
 6078 
     | 
    
         
            +
                    try {
         
     | 
| 
      
 6079 
     | 
    
         
            +
                      const $1 = $(this);
         
     | 
| 
      
 6080 
     | 
    
         
            +
                      const [sElementPrefix, listingid, appid, contextid, itemid] = $1.find('.market_listing_cancel_button > a').attr('href').split('(')[1].split(')')[0].split(',').map(r => r.trim().replaceAll(`'`, '').replaceAll(`"`, ''))
         
     | 
| 
      
 6081 
     | 
    
         
            +
                      const image = $1.find(`#mylisting_${listingid}_image`).attr('src')
         
     | 
| 
      
 6082 
     | 
    
         
            +
                      const buyer_pays_price = parseInt($1.find(`.market_listing_price span[title="This is the price the buyer pays."]`).text().replaceAll(`(`, '').replaceAll(`)`, '').replaceAll(`₫`, '').replaceAll(`.`, '').replaceAll(`,`, '').trim())
         
     | 
| 
      
 6083 
     | 
    
         
            +
                      const receive_price = parseInt($1.find(`.market_listing_price span[title="This is how much you will receive."]`).text().replaceAll(`(`, '').replaceAll(`)`, '').replaceAll(`₫`, '').replaceAll(`.`, '').replaceAll(`,`, '').trim())
         
     | 
| 
      
 6084 
     | 
    
         
            +
                      const item_name = $1.find('.market_listing_item_name_link').text()
         
     | 
| 
      
 6085 
     | 
    
         
            +
                      const game_name = $1.find('.market_listing_game_name').text()
         
     | 
| 
      
 6086 
     | 
    
         
            +
                      const date_combined = $1.find('.market_listing_listed_date_combined').text().replaceAll(`Listed:`,'').replaceAll(/[\t\n\r]/gi, ' ').replaceAll(/\s+/gi, ' ').trim()
         
     | 
| 
      
 6087 
     | 
    
         
            +
                      list.push({
         
     | 
| 
      
 6088 
     | 
    
         
            +
                        listingid,
         
     | 
| 
      
 6089 
     | 
    
         
            +
                        appid,
         
     | 
| 
      
 6090 
     | 
    
         
            +
                        contextid,
         
     | 
| 
      
 6091 
     | 
    
         
            +
                        itemid,
         
     | 
| 
      
 6092 
     | 
    
         
            +
                        buyer_pays_price,
         
     | 
| 
      
 6093 
     | 
    
         
            +
                        receive_price,
         
     | 
| 
      
 6094 
     | 
    
         
            +
                        item_name,
         
     | 
| 
      
 6095 
     | 
    
         
            +
                        game_name,
         
     | 
| 
      
 6096 
     | 
    
         
            +
                        date_combined,
         
     | 
| 
      
 6097 
     | 
    
         
            +
                        image,
         
     | 
| 
      
 6098 
     | 
    
         
            +
                      })
         
     | 
| 
      
 6099 
     | 
    
         
            +
                    } catch (e) {
         
     | 
| 
      
 6100 
     | 
    
         
            +
                    }
         
     | 
| 
      
 6101 
     | 
    
         
            +
                  })
         
     | 
| 
      
 6102 
     | 
    
         
            +
                  const assets = Object.values(result.assets["730"]["2"])
         
     | 
| 
      
 6103 
     | 
    
         
            +
                  return {list, assets, success: true}
         
     | 
| 
      
 6104 
     | 
    
         
            +
                }
         
     | 
| 
      
 6105 
     | 
    
         
            +
              }
         
     | 
| 
       6057 
6106 
     | 
    
         
             
            }
         
     | 
| 
       6058 
6107 
     | 
    
         | 
| 
       6059 
6108 
     | 
    
         
             
            export default SteamUser
         
     |