[GiphyBridge] include bundle parameter in api calls to reduce bandwidth (#2627)

This commit is contained in:
User123698745 2022-04-10 15:21:43 +02:00 committed by GitHub
parent c498749c2b
commit 7833d0e6c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -62,9 +62,10 @@ HTML
* but it has severe rate limiting.
*
* https://giphy.api-docs.io/1.0/welcome/access-and-api-keys
* https://giphy.api-docs.io/1.0/gifs/search-1
* https://developers.giphy.com/branch/master/docs/api/endpoint/#search
*/
$apiKey = 'Gc7131jiJuvI7IdN0HZ1D7nh0ow5BU6g';
$bundle = 'low_bandwidth';
$limit = min($this->getInput('n') ?: 10, 50);
$endpoints = array();
if (empty($this->getInput('noGif'))) {
@ -76,10 +77,11 @@ HTML
foreach ($endpoints as $endpoint) {
$uri = sprintf(
'https://api.giphy.com/v1/%s/search?q=%s&limit=%s&api_key=%s',
'https://api.giphy.com/v1/%s/search?q=%s&limit=%s&bundle=%s&api_key=%s',
$endpoint,
rawurlencode($this->getInput('s')),
$limit,
$bundle,
$apiKey
);