James Riley (Oct 27 1777 - Mar 13, 1840), aka Captain James Riley, was a sea captain and author.
He captained the sailing ship Commerce which, after sailing for several days in heavy fog, ran aground on August 28, 1815 at Cape Bojador, off the coast of Morocco. The captain and eleven crew members rowed to shore and were attacked by the Sahrawi natives and one of the crew was murdered in the encounter. The captain and crew returned to their rowboat and tried to reach the Cape Verde Islands, in hopes of being rescued by a passing ship. With provisions running out, they abandoned the effort and decided to take their chances on shore. They turned the rowboat around and landed 300 miles south of the first attack, near Cape Barbas. They were taken captive by nomads of the Oulad Bou Sbaa tribe and sold into brutal slavery.
After being rescued from slavery and returned to America, Captain Riley, published a tale of their ordeal in 1817 under the title Authentic Narrative of the Loss of the American Brig 'Commerce' by the 'Late Master and Supercargo' James Riley. The book was republished and is more commonly known as Sufferings In Africa. It has been famously cited by President Abraham Lincoln as on of the three most influential books that he ever read, along with The Bible and The Pilgrim's Progress.