设常数 $\alpha>0, \beta>0$, 若反常积分 $\int_{\frac{\pi}{2}}^\pi \frac{1}{(-\cos x)^\alpha(1+\cos x)^\beta} \mathrm{d} x$ 收敛, 则
A. $0 < \alpha < 1,0 < \beta < 1$.
B. $0 < \alpha < \frac{1}{2}, 0 < \beta < \frac{1}{2}$.
C. $0 < \alpha < 1,0 < \beta < \frac{1}{2}$.
D. $0 < \alpha < \frac{1}{2}, 0 < \beta < 1$.