Esempio n. 1
0
def download_command(filename, link, limit=None, output_dir=None):
    bool(output_dir) and not os.path.exists(output_dir) and os.makedirs(output_dir)
    print "\033[32m" + filename + "\033[0m"
    firefox_ua = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0'
    cmd = "aria2c -c -o '{filename}' -s5 -x5" \
          " --user-agent='{useragent}' --header 'Referer:http://pan.baidu.com/disk/home'" \
          " {limit} {dir} '{link}'".format(filename=filename, useragent=firefox_ua, link=link,
                                           limit=convert_none('--max-download-limit=', limit),
                                           dir=convert_none('--dir=', output_dir))
    subprocess.call(cmd, shell=True)
Esempio n. 2
0
def download_command(filename, link, cookies, limit=None, output_dir=None):
    bool(output_dir) and not os.path.exists(output_dir) and os.makedirs(output_dir)
    print("\033[32m" + filename + "\033[0m")
    pan_ua = 'netdisk;4.4.0.6;PC;PC-Windows;6.2.9200;WindowsBaiduYunGuanJia'
    cmd = "aria2c -c -o '{filename}' -s5 -x5" \
          " --user-agent='{useragent}' --header 'Referer:http://pan.baidu.com/disk/home'" \
          " --header 'Cookies: {cookies}' {limit} {dir}" \
          " '{link}'".format(filename=filename, useragent=pan_ua, link=link,
                             cookies=cookies,
                             limit=convert_none('--max-download-limit=', limit),
                             dir=convert_none('--dir=', output_dir))
    subprocess.call(cmd, shell=True)
Esempio n. 3
0
def download_command(filename, link, cookies, limit=None, output_dir=None):
    bool(output_dir) and not os.path.exists(output_dir) and os.makedirs(
        output_dir)
    print("\033[32m" + filename + "\033[0m")
    pan_ua = 'netdisk;4.4.0.6;PC;PC-Windows;6.2.9200;WindowsBaiduYunGuanJia'
    cmd = "aria2c -c -o '{filename}' -s5 -x5" \
          " --user-agent='{useragent}' --header 'Referer:http://pan.baidu.com/disk/home'" \
          " --header 'Cookies: {cookies}' {limit} {dir}" \
          " '{link}'".format(filename=filename, useragent=pan_ua, link=link,
                             cookies=cookies,
                             limit=convert_none('--max-download-limit=', limit),
                             dir=convert_none('--dir=', output_dir))
    subprocess.call(cmd, shell=True)
Esempio n. 4
0
def download_command(filename, link, limit=None, output_dir=None):
    bool(output_dir) and not os.path.exists(output_dir) and os.makedirs(output_dir)
    print "\033[32m" + filename + "\033[0m"
    firefox_ua = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0'
    cmd = "aria2c -c -o '%(filename)s' -s5 -x5" \
          " --user-agent='%(useragent)s' --header 'Referer:http://pan.baidu.com/disk/home'" \
          " %(limit)s %(dir)s '%(link)s'" % {
              "filename": filename,
              "useragent": firefox_ua,
              "limit": convert_none('--max-download-limit=', limit),
              "dir": convert_none('--dir=', output_dir),
              "link": link
          }
    subprocess.call(cmd, shell=True)
Esempio n. 5
0
def download_command(filename, link, cookies, limit=None, output_dir=None):
    reload(sys)
    sys.setdefaultencoding("utf-8")
    bool(output_dir) and not os.path.exists(output_dir) and os.makedirs(output_dir)
    print("\033[32m" + filename + "\033[0m")
    pan_ua = 'netdisk;5.2.6;PC;PC-Windows;6.2.9200;WindowsBaiduYunGuanJia'
    cmd = 'aria2c -c -o "{filename}" -s5 -x5' \
          ' --user-agent="{useragent}" --header "Referer:http://pan.baidu.com/disk/home"' \
          ' {cookies} {limit} {dir}' \
          ' "{link}"'.format(filename=filename, useragent=pan_ua, link=link,
                             cookies=convert_none("--header \"Cookies: ", cookies),
                             limit=convert_none('--max-download-limit=', limit),
                             dir=convert_none('--dir=', output_dir))
    subprocess.call(cmd, shell=True)
Esempio n. 6
0
 def _get_json(self, fs_id, input_code=None, vcode=None):
     """Post fs_id to get json of real download links"""
     url = 'http://pan.baidu.com/share/download?channel=chunlei&clienttype=0&web=1' \
           '&uk={self.uk}&shareid={self.shareid}&timestamp={self.timestamp}&sign={self.sign}{bdstoken}{input_code}' \
           '{vcode}&channel=chunlei&clienttype=0&web=1'.format(self=self,
                                                               bdstoken=convert_none('&bdstoken=', self.bdstoken),
                                                               input_code=convert_none('&input=', input_code),
                                                               vcode=convert_none('&vcode=', vcode))
     logging.debug(url)
     post_data = 'fid_list=["{}"]'.format(fs_id)
     logging.debug(post_data)
     req = self.opener.open(url, post_data)
     json_data = json.load(req)
     return json_data
Esempio n. 7
0
def download_command(filename, link, cookies, limit=None, output_dir=None):
    reload(sys)
    sys.setdefaultencoding("utf-8")
    bool(output_dir) and not os.path.exists(output_dir) and os.makedirs(output_dir)
    print("\033[32m" + filename + "\033[0m")
    pan_ua = 'netdisk;4.4.0.6;PC;PC-Windows;6.2.9200;WindowsBaiduYunGuanJia'
    cmd = 'aria2c -c -o "{filename}" -s5 -x5' \
          ' --user-agent="{useragent}" --header "Referer:http://pan.baidu.com/disk/home"' \
          ' {cookies} {limit} {dir}' \
          ' "{link}"'.format(filename=filename, useragent=pan_ua, link=link,
                             cookies=convert_none("--header \"Cookies: \"", cookies),
                             limit=convert_none('--max-download-limit=', limit),
                             dir=convert_none('--dir=', output_dir))
    subprocess.call(cmd, shell=True)
Esempio n. 8
0
 def _get_json(self, fs_id, input_code=None, vcode=None):
     """Post fs_id to get json of real download links"""
     url = 'http://pan.baidu.com/share/download?channel=chunlei&clienttype=0&web=1' \
           '&uk=%s&shareid=%s&timestamp=%s&sign=%s%s%s%s' \
           '&channel=chunlei&clienttype=0&web=1' % \
           (self.uk, self.shareid, self.timestamp, self.sign,
            convert_none('&bdstoken=', self.bdstoken),
            convert_none('&input=', input_code),
            convert_none('&vcode=', vcode))
     logging.debug(url)
     post_data = 'fid_list=["%s"]' % fs_id
     logging.debug(post_data)
     req = self.opener.open(url, post_data)
     json_data = json.load(req)
     return json_data
Esempio n. 9
0
def download_command(filename, link, limit=None, output_dir=None):
    bool(output_dir) and not os.path.exists(output_dir) and os.makedirs(
        output_dir)
    print "\033[32m" + filename + "\033[0m"
    firefox_ua = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0'
    cmd = "aria2c -c -o '%(filename)s' -s5 -x5" \
          " --user-agent='%(useragent)s' --header 'Referer:http://pan.baidu.com/disk/home'" \
          " %(limit)s %(dir)s '%(link)s'" % {
              "filename": filename,
              "useragent": firefox_ua,
              "limit": convert_none('--max-download-limit=', limit),
              "dir": convert_none('--dir=', output_dir),
              "link": link
          }
    subprocess.call(cmd, shell=True)
Esempio n. 10
0
 def _get_json(self, fs_id, input_code=None, vcode=None):
     """Post fs_id to get json of real download links"""
     url = 'http://pan.baidu.com/share/download?channel=chunlei&clienttype=0&web=1' \
           '&uk=%s&shareid=%s&timestamp=%s&sign=%s%s%s%s' \
           '&channel=chunlei&clienttype=0&web=1' % \
           (self.uk, self.shareid, self.timestamp, self.sign,
            convert_none('&bdstoken=', self.bdstoken),
            convert_none('&input=', input_code),
            convert_none('&vcode=', vcode))
     logging.debug(url)
     post_data = 'fid_list=["%s"]' % fs_id
     logging.debug(post_data)
     req = self.opener.open(url, post_data)
     json_data = json.load(req)
     return json_data