def cloud_query_magnetinfo(cookie, tokens, source_url, save_path):
 url = ''.join([const.PAN_URL, 'rest/2.0/services/cloud_dl?channel=chunlei&clienttype=0&web=1', '&bdstoken=', tokens['bdstoken']])
 data = ''.join(['method=query_magnetinfo&app_id=250528', '&source_url=', encoder.encode_uri_component(source_url), '&save_path=', encoder.encode_uri_component(save_path), '&type=4'])
 req = net.urlopen(url, headers={'Cookie': cookie.header_output()}, data=data.encode())
 if req:
  content = req.data
  return json.loads(content.decode())
 else:
  return None

def cloud_query_magnetinfo ( cookie , tokens , source_url , save_path ) : url = '' . join ( [ const . PAN_URL , 'rest/2.0/services/cloud_dl?channel=chunlei&clienttype=0&web=1' , '&bdstoken=' , tokens [ 'bdstoken' ] ] ) data = '' . join ( [ 'method=query_magnetinfo&app_id=250528' , '&source_url=' , encoder . encode_uri_component ( source_url ) , '&save_path=' , encoder . encode_uri_component ( save_path ) , '&type=4' ] ) req = net . urlopen ( url , headers = { 'Cookie' : cookie . header_output ( ) } , data = data . encode ( ) ) if req : content = req . data return json . loads ( content . decode ( ) ) else : return None
source_url - 磁链的url .