Why did Yanshayan build a nest on the river bank and soil slope?

Because the environment is good.

Cliff swallows are beneficial birds and like to nest on sandy cliffs. They are called "cliff architects". They like to make holes and build nests on soft sandy cliffs by rivers or lakes. April-June is the breeding period of swallow every year, and the incubation time is short, and it can be hatched in 12 ~ 15 days.