You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One may want to download from a site which require Authentication or cookie to download.
changes in pySmartDL.py:
So, i tried to introduce a cookie_jar in the constructor on pySmartDL def __init__(self, urls, dest=None, progress_bar=True, fix_urls=True, threads=5, timeout=5, logger=None, connect_default_logger=False, request_args=None, cookie_jar=cookie()): self.cookie_jar = cookie_jar
and did following change in start() method:
for i, arg in enumerate(args):
req = self.pool.submit(
download,
self.url,
self.dest+".%.3d" % i,
self.requestArgs,
arg[0],
arg[1],
self.timeout,
self.shared_var,
self.thread_shared_cmds,
self.logger,
3,
self.cookie_jar
)
changes in download.py:
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie_jar))
cj = cookie_jar._cookies[domain]['/'][cookie_name] #i provided domain and cookie_name explicitly but we also have to fetch it or take it from user
ctuple = (cj.name, cj.value)
opener.addheaders = [ctuple, ('User-Agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)
but after introducing it, it still not working on site with cookies it is giving socket time out error and i don't know much about networking so i hope you can help.
The text was updated successfully, but these errors were encountered:
One may want to download from a site which require Authentication or cookie to download.
changes in pySmartDL.py:
So, i tried to introduce a cookie_jar in the constructor on pySmartDL
def __init__(self, urls, dest=None, progress_bar=True, fix_urls=True, threads=5, timeout=5, logger=None, connect_default_logger=False, request_args=None, cookie_jar=cookie()):
self.cookie_jar = cookie_jar
and did following change in start() method:
changes in download.py:
but after introducing it, it still not working on site with cookies it is giving socket time out error and i don't know much about networking so i hope you can help.
The text was updated successfully, but these errors were encountered: