Were they actually saying "Yarr" constantly? or do the media just get the small amount of 'interesting bits' from pirate history and base everything off that?
My knowledge of pirates on the whole is rather limited but the traditional pirate accent was invented by the first actor who played a pirate in talkie movies. It's heavily based on the accent of the West Country in Britain (Devon, Dorset, Somerset, Cornwall), effectively rural farmer accents. Robert Newton who played Long John Silver in 1950s Treasure Island and then Blackbeard in the 1952 movie used his West Country accent and seemed to start the trend for 'Yarr'.
As with all history we must remember that pirates are remarkably diverse. A privateer working in the Caribbean would be very different from a European pirate. We tend to assume illegal activity and upsetting the authorities, forgetting that some pirates were officially sanctioned (Elizabeth I supported her privateers who raided Spanish ships). Equally there are pirates we don't hear much about, such as the Islamic pirates who caused so many problems for Charles V.