Skip to content

Commit

Permalink
支持添加BT,但仍无法上传BT文件
Browse files Browse the repository at this point in the history
  • Loading branch information
chliny committed Sep 27, 2013
1 parent 2e0d828 commit cd0ec23
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ http://lixian.qq.com/
可实现多线程,断点续传等特性

12 12 29 修复腾讯改版后无法登陆,和登陆验证referer

13 09 27 支持添加BT任务,但仍无法实现将BT文件信息上传,因此离线服务器已有的资源能够秒下,但其他种子会出现下载失败需要在网页上添加。
14 changes: 10 additions & 4 deletions xfdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,17 @@ def __addtask(self):
btfilename = "#".join(btfilenames)
btfilesize = "#".join(btsizes)

fileinfo = open(url,'rb').read()
fileinfo = open(url).read()
#fileinfo = self.__toUnicode(fileinfo).encode("utf8")
#print fileinfo
data1={"name":"myfile",
"Content-Disposition":"form-data",
"filename":filename,
"Content-Type":"application/x-bittorrent",
"myfile":fileinfo,
}
#print data1
data1={"myfile":fileinfo}

data2={"cmd":"add_bt_task",
#多个文件名以#隔开
"filename":btfilename,
Expand All @@ -398,7 +401,7 @@ def __addtask(self):

urlv1="http://lixian.qq.com/handler/bt_handler.php?cmd=readinfo"
istr = self.__request(urlv1,data1)
#print istr
print istr

urlv2="http://lixian.qq.com/handler/xfjson2012.php"
istr = self.__request(urlv2,data2)
Expand All @@ -422,7 +425,10 @@ def __toUnicode(self,word):
try:
word = word.decode("utf8")
except:
word = word.decode("GBK")
try:
word = word.decode("GBK")
except:
word = word.decode("latin")

return word

Expand Down

0 comments on commit cd0ec23

Please # to comment.