History help!

1.Who invaded Spain and Portugal and unknowingly encouraged the colonies to rebel?

2.Who teamed up with Francisco de Miranda to help Venezuela achieve independence?