I've been really interested in data scraping and headless browsing and was ready to put some samples in my portfolio for future clients ... after doing some research on this topic I found that there's tons of lawsuit against scrappers (the most famous one is Facebook lawsuit against Power.com
my question is : as a freelancer developer should I be worried about the legality of every code I provide ? Should I demand signing some kind of contract whenever I sell the simplest code ? Is it enough stating that I'm not responsible for the usage of this code by the client ?