Skip to content

Commit

Permalink
参数设置为全局变量
Browse files Browse the repository at this point in the history
  • Loading branch information
gaowanliang committed Jun 2, 2021
1 parent e92e0f4 commit 4b6c84e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
25 changes: 17 additions & 8 deletions havepassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
from main import getFiles, downloadFiles, header
from pprint import pprint


OneDriveShareURL = "https://jia666-my.sharepoint.com/:f:/g/personal/1025_xkx_me/EsqNMFlDoyZKt-RGcsI1F2EB6AiQMBIpQM4Ka247KkyOQw?e=oC1y7r"
OneDriveSharePwd = "xkx"

aria2Link = "http://localhost:5800/jsonrpc"
aria2Secret = "123456"

isDownload = False
downloadStart = 1
downloadNum = -1


os.environ['PYPPETEER_HOME'] = os.path.split(os.path.realpath(__file__))[0]
# os.environ['PYPPETEER_DOWNLOAD_HOST'] = "http://npm.taobao.org/mirrors"

Expand Down Expand Up @@ -52,12 +64,9 @@ def havePwdDownloadFiles(iurl, password, aria2URL, token, start=1, num=-1):
downloadFiles(url, None, 0, aria2URL, token, start=start, num=num)


if __name__ == "__main1__":
havePwdGetFiles(
'https://jia666-my.sharepoint.com/:f:/g/personal/1025_xkx_me/EsqNMFlDoyZKt-RGcsI1F2EB6AiQMBIpQM4Ka247KkyOQw?e=oC1y7r', "xkx")

if __name__ == "__main__":
havePwdDownloadFiles("https://jia666-my.sharepoint.com/:f:/g/personal/1025_xkx_me/EsqNMFlDoyZKt-RGcsI1F2EB6AiQMBIpQM4Ka247KkyOQw?e=oC1y7r",
"xkx",
'http://localhost:5800/jsonrpc',
"GAOwan", start=10, num=5)
if isDownload:
havePwdDownloadFiles(OneDriveShareURL, OneDriveSharePwd, aria2Link,
aria2Secret, start=downloadStart, num=downloadNum)
else:
havePwdGetFiles(OneDriveShareURL, OneDriveSharePwd)
18 changes: 16 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
import requests
import os

OneDriveShareURL = "https://gitaccuacnz2-my.sharepoint.com/:f:/g/personal/mail_finderacg_com/EheQwACFhe9JuGUn4hlg9esBsKyk5jp9-Iz69kqzLLF5Xw?e=FG7SHh"

aria2Link = "http://localhost:5800/jsonrpc"
aria2Secret = "123456"

isDownload = False
downloadStart = 1
downloadNum = -1


header = {
'sec-ch-ua-mobile': '?0',
'upgrade-insecure-requests': '1',
Expand Down Expand Up @@ -196,7 +206,11 @@ def getFilesHavePwd(originalPath, password):


if __name__ == "__main__":
getFiles("https://gw6-my.sharepoint.com/:f:/g/personal/admin_gwliang_com/EvyrJ1GVBJBCjI42SuqG4yIBFxT-B5tUsyDsTKiZQX97uw?e=jtqYl0", None, 0)
# downloadFiles("https://gitaccuacnz2-my.sharepoint.com/:f:/g/personal/mail_finderacg_com/EheQwACFhe9JuGUn4hlg9esBsKyk5jp9-Iz69kqzLLF5Xw?e=FG7SHh", 'http://localhost:5800/jsonrpc', "123456")
if isDownload:
downloadFiles(OneDriveShareURL, aria2Link, aria2Secret,
start=downloadStart, num=downloadNum)
else:
getFiles(OneDriveShareURL, None, 0)
#
# getFilesHavePwd(
# "https://jia666-my.sharepoint.com/:f:/g/personal/1025_xkx_me/EsqNMFlDoyZKt-RGcsI1F2EB6AiQMBIpQM4Ka247KkyOQw?e=oC1y7r&guestaccesstoken=xyz", "xkx")
27 changes: 27 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# OneDriveShareLinkPushAria2
Extract the download URL from OneDrive or SharePoint share link and push it to aria2

从OneDrive或SharePoint共享链接提取下载URL并将其推送到aria2

# 使用方法

目前本程序支持的下载方式:
* xxx-my.sharepoint.com 下载链接的下载
* 无下载密码的多文件推送
* 有下载密码的多文件推送
* 嵌套文件夹的文件推送
* 任意选择文件推送
* xxx-my.sharepoint.cn 下载链接的下载(理论上支持)

## 无密码的链接

https://gitaccuacnz2-my.sharepoint.com/:f:/g/personal/mail_finderacg_com/EheQwACFhe9JuGUn4hlg9esBsKyk5jp9-Iz69kqzLLF5Xw?e=FG7SHh 这个下载链接为例

此时需要使用无密码的下载代码,也就是[main.py](main.py),打开这个文件,可以看到有一些全局变量:
* OneDriveShareURL: 下载地址,此处应该填写 https://gitaccuacnz2-my.sharepoint.com/:f:/g/personal/mail_finderacg_com/EheQwACFhe9JuGUn4hlg9esBsKyk5jp9-Iz69kqzLLF5Xw?e=FG7SHh
* aria2Link: aria2 的rpc地址,如果是本机,一般是 `http://localhost:端口号/jsonrpc`
* aria2Secret: aria2 的密码
* isDownload: 是否下载,如果是`False`,只输出文件列表
* downloadStart: 下载起始文件的号码,默认为1
* downloadNum: 从downloadStart开始的文件连续下载多少个,-1表示全部下载

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
requests==2.25.1
pyppeteer==0.2.5

0 comments on commit 4b6c84e

Please sign in to comment.