perl -l -0777 -ne "print for /'''(.*?)'''/gs" file
would extract (and print followed by a newline) the part between each pair of '''.
Beware that perl slurps the whole file in memory before starting processing it so that solution may not be appropriate for very large files.