Improve automatic filename extraction for wget