Abstract. Urban floods present a threat in China, demanding an understanding of their spatiotemporal distribution. Current flood datasets primarily offer provincial-scale insights and lack temporal continuity, which leads to a challenge in detailed analysis. To create a consistent national dataset of flood events, this study introduces a machine learning framework by applying online news media as a primary data source to construct a county-level dataset of urban flood events from 2000 to 2022. Using the Bidirectional Encoder Representations from Transformers (BERT) model, we achieved robust performance in information extraction, with an F1 score of 0.86 and an exact match score of 0.82. Further, a combined model of Bidirectional Long Short-term Memory (BiLSTM) networks with a Conditional Random Field (CRF) layer effectively identified flood locations. Our analysis reveals that the temporal trend of flooded cities in the news-based dataset is similar to the China Flood and Drought Bulletin. Furthermore, the consistency of flood events in the news with the typhoon trajectory in two cases, and the connection between flood occurrences and flood conditioning factors, confirm the accuracy of spatial distribution. The validated news-based dataset analyzes urban floods in China from both temporal and spatial perspectives. First, this dataset shows the seasonal characteristics of flood events, which are concentrated in the summer. From 2000 to 2022, the peak year for floods was 2010, and excluding the influence of peak year, the overall temporal trend of total flood occurrence shows an increase. Spatially, the distribution of floods decreases from southeast to northwest, with Guangxi Province having the highest number of floods. Additionally, the Yangtze and Pearl River basins are most frequently affected by urban floods. The subtropical climate zone is the most susceptible to flooding. This study provides an automated and effective method for constructing a national flood event dataset and reveals the spatiotemporal characteristics of urban flooding in China.