UncleGoogle / galaxy-integration-humblebundle

Humble Bundle integration for GOG Galaxy 2.0
GNU General Public License v3.0
187 stars 18 forks source link

Subscription autodetection #106

Closed UncleGoogle closed 4 years ago

UncleGoogle commented 4 years ago

Currently I haven't found a way check if (and which subscription type) user has activated. No API calls are done by humblebundle.com, though the webapp knows that user is subscriber. Apparently it is resolved somewhere in js as ajax or with websockets. I'm not sure how to inspect those. If anybody find a way, please let me now!

Last workaround was: https://github.com/UncleGoogle/galaxy-integration-humblebundle/blob/master/src/webservice.py#L106 but the result is the same for active and expired (past) subscribers.

UncleGoogle commented 4 years ago

userHasSubscription field is in <script id="webpack-user-settings-data" type="application/json"> under https://www.humblebundle.com/user/settings

All subscription games in <script id="webpack-choice-marketing-data" type="application/json"> under https://www.humblebundle.com/subscription/home

User choice history data, left picks, and also games definitions in: https://www.humblebundle.com/api/v1/subscriptions/humble_monthly/subscription_products_with_gamekeys/

UncleGoogle commented 4 years ago

Humble Monthly:

Example: https://www.humblebundle.com/monthly/p/august_2019_monthly -> <script id="webpack-monthly-product-data" type="application/json">

"webpack_json": {
 "userSubscriptionPlan": {
      "human_name": "Month-to-Month Classic Plan",
      "length": 1,
      "machine_name": "monthly_basic",
      "pricing|money": {
        "currency": "USD",
        "amount": 12
      }
    },
  }
"navbarOptions": {
    "product_human_name": "August 2019 Humble Monthly",
    "price_to_subscribe": {
      "currency": "EUR",
      "amount": 17.99
    },
    "sections": [
      {
        "human_name": "Kingdom Come: Deliverance",
        "delivery_methods": [
          "epic",
          "steam"
        ],
        "id": "kingdomcome_deliverance",
        "platforms": [
          "windows"
        ]
      },

userSubscriptionPlan can be null if no subscription for given month


Humble Choice - for example: https://www.humblebundle.com/subscription/february-2020 the same <script id="webpack-monthly-product-data" type="application/json"> has additional payEarlyOptions, userSubscriptionPlan remains the same, games are put in ["contentChoiceOptions"]["contentChoiceData"].

  "payEarlyOptions": {
    "activeContentStart|datetime": "2020-05-01T17:00:00",
    "productMachineName": "may_2020_choice"
  },
  "isEuCountry": true,
  "contentChoiceOptions": {
    "contentChoiceData": {
      "initial": {
        "content_choices": {
          "warstonetd": {
            "genres": [
              "indie",
              "strategy"
            ],
            "delivery_methods": [
              "steam"
            ],
            "description": "<p>..."
            "title": "Warstone TD",
            "carousel_content": {
              "youtube-link": [
                "O3X11L519gk"
              ],
              "thumbnails": [
                "https://hb.imgix.net/a476c6c0990ee44a5328c238ccfdd9a651d3a49e.jpg?auto=compress,format&fit=crop&h=122&w=218&s=ae59039c7dd6406e05ad0b89d06c5d4d",
                "..."
              ],
              "screenshot": [
                "https://hb.imgix.net/a476c6c0990ee44a5328c238ccfdd9a651d3a49e.jpg?auto=compress,format&fit=crop&h=425&w=741&s=63e61ec9c53475ae58b6af48a3972982",
                "..."
              ]
            },
            "image": "https://hb.imgix.net/a8eb4fadef1301464e026c8348d776482b21ec0f.jpg?auto=compress,format&fit=clip&h=383&w=667&s=0a2052fc969086da7862c9441da3d5a3",
            "display_item_machine_name": "warstonetd",
            "tpkds": [
            ],
            "platforms": [
              "windows"
            ],
            "more_information": null,
            "msrp|money": {
              "currency": "EUR",
              "amount": 14.99
            },
            "developers": [
              "Battlecruiser Games"
            ],
            "system_requirements": "text..."
          },
          "eliza": {
            "genres": [
              "indie"
            ],
            "delivery_methods": [
              "download",
              "steam"
            ],
            "platforms": [
              "mac",
              "linux",
              "windows"
            ],
            "link_to_download_page": true