-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
49 lines (37 loc) · 1.17 KB
/
client.py
File metadata and controls
49 lines (37 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# coding=utf-8
from youku import YoukuUpload
import aliyun.oss as aliyun_oss
import conf.conf_oss as oss_conf
import conf.conf_youku as youku_conf
from youku.util import check_error, YoukuError
def main():
file = "00d64e1f7701c62b5ba6123303ca5961"
def download():
oss_sdk = aliyun_oss.OSS(oss_conf.ak, oss_conf.sk, oss_conf.endpoint, oss_conf.bucket)
result = oss_sdk.download('user/dee/' + file, file + '.mp4')
print result
def upload():
file_info = {
'title': u'优酷合作测试-VID',
'tags': 'other',
'description': 'Polymer video #7'
# 'category': 'Tech'
}
youku = YoukuUpload(youku_conf.CLIENT_ID, youku_conf.ACCESS_TOKEN, file + ".mp4")
# youku.create(youku.prepare_video_params(**params))
# youku.create_file()
# youku.upload_slice()
# youku.check()
# youku.commit()
# youku.cancel()
# youku.spec()
try:
vid = youku.upload(file_info)
print vid
except YoukuError, e:
print e
download()
upload()
if __name__ == '__main__':
main()