The outbreak of the COVID-19 Omicron variant in Shanghai in 2022 elicited complex emotions among Shanghainese during the two-month quarantine period. This paper aims to identify prevailing public themes and sentiments by analyzing social media posts from Weibo. Initially, we conducted research based on a dataset of 90,000 Weibo posts during the 2022 COVID-19 outbreak in Shanghai. By examining social media data that mirrors residents' emotional shifts and areas of focus during unforeseen circumstances, we have developed an analytical framework combining hotspot analysis and public sentiment assessment. Subsequently, we employed the Latent Dirichlet Allocation (LDA) method to conduct topic modeling on the Weibo text data. The SnowNLP sentiment classification method was then utilized to quantify sentiment values. Ultimately, we performed spatial visualization of sentiment and concern data, categorizing them into distinct time periods based on Shanghai's infection curve. This approach allowed us to investigate concern focal points, sentiment trends, and their spatiotemporal evolution characteristics. Our findings indicate that variations in public sentiment primarily hinge on the severity of the epidemic's spread, emerging events, the availability of essential resources, and the government's ability to respond promptly and accurately. It is evident that, while residents' concerns shift over time, their primary objective on social media remains expressing demands and releasing emotions. This research offers an avenue for leveraging public opinion analysis to enhance governance capacity during crises, fortify urban resilience, and promote public involvement in governmental decision-making processes.