Open jordansissel opened 1 year ago
When calling getFavorites(), in my test, node-sonos gives me two (2) results. In the macOS Sonos app, I show four (4) entries.
It should return the same items as the Sonos app has.
It omits (due to some weirdness in Sonos UPnP?) certain records.
const axios = require("axios"); axios.defaults.headers.common['User-Agent'] = "Linux UPnP/1.0 Sonos/70.4-35282 (MDCR_Mac14,2)"
This sets the default 'User-Agent' header on all axios requests.
I discovered this by sniffing traffic between the Sonos app and my network and comparing the results, then trying to change one thing at a time to see what improved the outcome.
device.getFavorites() .then(result => { console.log(`Total (default): ${result.total}`) }) .then(() => { const axios = require("axios"); axios.defaults.headers.common['User-Agent'] = "Linux UPnP/1.0 Sonos/70.4-35282 (MDCR_Mac14,2)" return device.getFavorites() }).then(result => { console.log(`Total (after setting user-agent): ${result.total}`) })
Total (default): 2 Total (after setting user-agent): 4
Node version: v19.2.0 node-sonos version: 1.14.1 OS: macOS
When calling getFavorites(), in my test, node-sonos gives me two (2) results. In the macOS Sonos app, I show four (4) entries.
Expected Behavior
It should return the same items as the Sonos app has.
Current Behavior
It omits (due to some weirdness in Sonos UPnP?) certain records.
Possible Solution
This sets the default 'User-Agent' header on all axios requests.
I discovered this by sniffing traffic between the Sonos app and my network and comparing the results, then trying to change one thing at a time to see what improved the outcome.
Sample code or executed example
Versions (and Environment)
Node version: v19.2.0 node-sonos version: 1.14.1 OS: macOS