Extraction and processing of petroleum and natural gas