You need to say "... about the history of Madrid". With this correction, both sentences are possible, but normally one would just say "I like books about the history of Madrid".
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.