]>
Raphaƫl G. Git Repositories - youtubedl/blob - test/helper.py
842ffc2fd32e606f2b7a359395f541fd1abf905e
5 from youtube_dl
import YoutubeDL
, YoutubeDLHandler
6 from youtube_dl
.utils
import (
11 # General configuration (from __init__, not very elegant...)
12 jar
= compat_cookiejar
.CookieJar()
13 cookie_processor
= compat_urllib_request
.HTTPCookieProcessor(jar
)
14 proxy_handler
= compat_urllib_request
.ProxyHandler()
15 opener
= compat_urllib_request
.build_opener(proxy_handler
, cookie_processor
, YoutubeDLHandler())
16 compat_urllib_request
.install_opener(opener
)
18 PARAMETERS_FILE
= os
.path
.join(os
.path
.dirname(os
.path
.abspath(__file__
)), "parameters.json")
19 with io
.open(PARAMETERS_FILE
, encoding
='utf-8') as pf
:
20 parameters
= json
.load(pf
)
22 class FakeYDL(YoutubeDL
):
25 # Different instances of the downloader can't share the same dictionary
26 # some test set the "sublang" parameter, which would break the md5 checks.
27 self
.params
= dict(parameters
)
28 def to_screen(self
, s
):
30 def trouble(self
, s
, tb
=None):
32 def download(self
, x
):