From c6e9442782439c4e392978a8a66a6264e9041973 Mon Sep 17 00:00:00 2001 From: Enes Date: Fri, 1 Jun 2018 02:13:47 +0300 Subject: [PATCH] [openload] added test for determine_ext and determining file extension was simplified --- test/test_utils.py | 1 + youtube_dl/extractor/openload.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/test_utils.py b/test/test_utils.py index a1fe6fdb2..b4b9e8d7c 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -360,6 +360,7 @@ class TestUtil(unittest.TestCase): self.assertEqual(determine_ext('http://example.com/foo/bar.nonext/?download', None), None) self.assertEqual(determine_ext('http://example.com/foo/bar/mp4?download', None), None) self.assertEqual(determine_ext('http://example.com/foo/bar.m3u8//?download'), 'm3u8') + self.assertEqual(determine_ext('foobar', None), None) def test_find_xpath_attr(self): testxml = ''' diff --git a/youtube_dl/extractor/openload.py b/youtube_dl/extractor/openload.py index 21d3af9b7..7ede4038a 100644 --- a/youtube_dl/extractor/openload.py +++ b/youtube_dl/extractor/openload.py @@ -361,9 +361,7 @@ class OpenloadIE(InfoExtractor): # Some videos have special name and some of these # have not got their extension on their title # If url has their file name, it has always its extension - video_ext = determine_ext(title, None) - if video_ext is None: - video_ext = determine_ext(url, 'mp4') + video_ext = determine_ext(title, None) or determine_ext(url, 'mp4') info_dict = { 'id': video_id,