heiseonline/shariff-backend-php

Reddit not returning share count

Closed this issue · 3 comments

onli commented

Hi, is the list of currently supported services still accurate? Reddit is not getting returned for me.

This is my configuration:

private static $configuration = [
        'cache' => [
            'ttl' => 310
        ],
	'domains' => [
        ],
	'services' => [
            'Facebook',
            'StumbleUpon',
            'Flattr',
            'Pinterest',
            'Xing',
            'AddThis',
            'Buffer',
            'Reddit',
            'Vk'
        ],
        'Facebook' => [
           'app_id' => '...',
           'secret' => '...'
        ]
    ];

But this is the output:

{"facebook":0,"stumbleupon":0,"flattr":0,"pinterest":0,"xing":0,"addthis":0,"buffer":0,"vk":0}

Every service is accounted for, the 0 is okay, but reddit not being in the array is strange.

I tried setting a custom user agent in the reddit client, but so far that changed nothing.

It's my experience that reddit reacts very aggressively when a client is not respecting 429 responses, might that be the issue here?

onli commented

Okay, it works now for me. Setting the user-agent seems to have done the trick, it just took a while.

I'd suggest to add this to the example configuration in the readme:

    'headers' => [
        'User-Agent' => 'shariff/1.0',
    ]
]

Should I open a PR?

If it's just the readme, I (normal user and contributor, no maintainer or so) would say go for it.

Can be closed now since @onli's pr (#172) is merged. Thanks for your work! 🙏