fix url_to_module

This commit is contained in:
Mort Yao 2014-02-14 21:09:57 +01:00
parent 1a0ed7db44
commit da4506c4e7
2 changed files with 17 additions and 23 deletions

View File

@ -66,7 +66,7 @@ def url_to_module(url):
#TODO
}
if k in downloads:
return downloads[k]
return downloads[k], url
else:
import http.client
conn = http.client.HTTPConnection(video_host)
@ -76,20 +76,14 @@ def url_to_module(url):
if location is None:
raise NotImplementedError(url)
else:
return url_to_module(location), location
return url_to_module(location)
def any_download(url, output_dir='.', merge=True, info_only=False):
try:
m, url = url_to_module(url)
except:
m = url_to_module(url)
m.download(url, output_dir=output_dir, merge=merge, info_only=info_only)
def any_download_playlist(url, output_dir='.', merge=True, info_only=False):
try:
m, url = url_to_module(url)
except:
m = url_to_module(url)
m.download_playlist(url, output_dir=output_dir, merge=merge, info_only=info_only)
def main():

View File

@ -8,7 +8,7 @@ from you_get.extractor.__main__ import url_to_module
def test_urls(urls):
for url in urls:
url_to_module(url).download(url, info_only = True)
url_to_module(url)[0].download(url, info_only = True)
class YouGetTests(unittest.TestCase):