but half the time the headline is "X Company beats expectations, stock slides anyway".... unless these are super outliers, it seems like the effect on the stock can be random
If it was truly half the time you would be right. But in reality it is less than half the time, so you can still come out ahead on average across multiple trades.
The example quote you give does happen of course but you tend to remember those cases more than the more common beats-expectations-stock-rises cases precisely because they feel more unexpected.
It's still not random. Usually those headlines are followed by articles in which a negative aspect that was found in the released numbers is detailed.
Like Netflix beating revenue and earnings expectations, and even beating new subscriber number expectations, but subscriber growth in a key market slowing much more than anticipated.
If you know all these numbers, you can screen them for potential negative catalysts that might counteract the positive effects of expectation beats. If you find none, you can relatively safely assume that the stock price will probably pop after release.