Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
Finally fixed #8 #9
Browse files Browse the repository at this point in the history
Sign need to match timestamp, if not errno will return 113.
  • Loading branch information
sdvcrx committed Dec 12, 2014
1 parent a9828f2 commit b656766
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bddown_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_dlink(self, link, secret=None):
info = FileInfo()
js = self._get_js(link, secret)
if info.match(js):
extra_params = dict(bdstoken=info.bdstoken, sign=info.sign, timestamp=str(int(time())))
extra_params = dict(bdstoken=info.bdstoken, sign=info.sign, timestamp=info.timestamp)
post_form = {
'encrypt': '0',
'product': 'share',
Expand Down Expand Up @@ -124,8 +124,6 @@ def get_dlink(self, link, secret=None):
_json = response.json()
errno = _json['errno']
continue
elif errno == 113:
continue
elif errno == 116:
raise DownloadError("The share file does not exist")
else:
Expand Down Expand Up @@ -200,6 +198,7 @@ def __init__(self):
self.fid_list = None
self.sign = None
self.filename = None
self.timestamp = None

def __call__(self, js):
return self.match(js)
Expand All @@ -224,6 +223,7 @@ def match(self, js):
self.fid_list = yun_data.get('FS_ID').strip('"')
self.sign = yun_data.get('SIGN').strip('"')
self.bdstoken = yun_data.get('MYBDSTOKEN').strip('"')
self.timestamp = yun_data.get('TIMESTAMP').strip('"')
if self.bdstoken:
return True
return False
Expand Down

0 comments on commit b656766

Please sign in to comment.