The history is way off, though. The rebellion that actually happened had nothing to do with people's dissatisfaction with either the emperor or his consort. In fact, as far as historians could tell from contemporary sources (instead of later hit pieces), both Xuanzong and Yang Guifei were popular with the people in the imperial core. That's why Xuanzong was called Ming Huang, the emperor of light. Yang Guifei's sin IRL had nothing to do with the Yang family. If anything, the Yang clan was considered loyal to the emperor to a fault by this time. Xuanzong had forgiven them all despite their previous failed attempts to challenge the Tang to revive their Sui Dynasty (including actually triggering a Gokturk invasion). The Yang clan became very popular again after supporting Xuanzong's restoration of the Tang against the Wu clan of the short-lived Later Zhou Dynasty (of Wu Zetian).
Instead Yang Guifei's was reviled because she became a supporter of the Turkic general An Lushan and prodded Xuanzong to continue increasing his rank and influence. This became a black mark against her name when An Lushan, under suspicion of raising an illegal army and concentrating military power in the frontiers in his own hands (like the earlier Han Dynasty's Dong Zhuo), was pushed into starting a rebellion against the Tang. He was helped by the increasing dissatisfaction of frontier peoples against the perceived neglect by central authorities and the extravagance of the Tang capital Chang'an compared to the poverty of the frontiers. The An-Shi rebellion was the worst war China ever had in its history up to that point, leading to many times the loss of live and territory that the previous fall of the Han Dynasty and the nomadic conquests of the Jin Dynasty had wrought.
When Xuanzong was forced to kill Yang Guifei, it wasn't because of any bad perception against the Yang clan. Instead he was forced to exterminate the Yang clan BECAUSE of Yang Guifei. The court blamed Yang Guifei for her support of An Lushan and extended her guilt to her clan.