Closed i4i4n closed 2 years ago
The following code
new bingVideoSearchV7({apiKey: "MY_KEY"}) .search({ parameters: { q: "some search", freshness: "Day", }, });
should fetch relevant video results "discovered within the last 24 hours" because of the freshness parameter value.
The request fails with the message "Parameter "freshness" could not be found in the list of supported parameters", although the parameter is in the list of valid parameters.
The bug seems to come from
var operation = { "path": "bing/v7.0/videos/search", "method": "GET", "headers": this.headers, "parameters": this.parameters.filter(function (p) { return p.name == 'cc' || p.name == 'count' || p.name == 'id' || p.name == 'mkt' || p.name == 'offset' || p.name == 'q' || p.name == 'safeSearch' || p.name == 'setLang' || p.name == 'textDecorations' || p.name == 'textFormat'; }).concat(this.queryStringParams) };
where queryStringParams is concatenated instead of filterQueryParams like in bingImageSearchV7 where the filter parameters work well.
var operation = { "path": "bing/v7.0/videos/search", "method": "GET", "headers": this.headers, "parameters": this.parameters.filter(function (p) { return p.name == 'cc' || p.name == 'count' || p.name == 'id' || p.name == 'mkt' || p.name == 'offset' || p.name == 'q' || p.name == 'safeSearch' || p.name == 'setLang' || p.name == 'textDecorations' || p.name == 'textFormat'; }).concat(this.filterQueryParams) };
Thanks @i4nch1k ! Fixed in 1.2.6.
Expected Behavior
The following code
should fetch relevant video results "discovered within the last 24 hours" because of the freshness parameter value.
Actual Behavior
The request fails with the message "Parameter "freshness" could not be found in the list of supported parameters", although the parameter is in the list of valid parameters.
Relevant Code
The bug seems to come from
where queryStringParams is concatenated instead of filterQueryParams like in bingImageSearchV7 where the filter parameters work well.
Possible solution
Specifications