-
Notifications
You must be signed in to change notification settings - Fork 0
/
putio.py
1977 lines (1416 loc) · 55 KB
/
putio.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# encoding: utf-8
# Created by Put.io.
# Copyright (c) 2010 Put.io.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Basic Tutorial:
from putio import *
# connecting your put.io with your api key and api secret
api = Api("123456","abcdef")
# getting your items
items = api.get_items()
for it in items:
print "%5s %s" % (it.id, it.name)
# creating a folder
newitem = api.create_folder(name="blabla")
# getting one item
item = api.get_items(id=newitem.id)[0]
#item = api.get_items()[0]
# getting an item info
item = item.update_info()
print item.name, item.id, item.is_dir, item.__dict__
# renaming an item
print "old name: %s" % item.name
newitem = item.rename_item("renamed by api")
print "new name: %s" % newitem.name
# moving an item to a target folder
# 0 being root of your files
newitem.move_item(target=0)
# deleting an item
newitem.delete_item()
# searching items
sresults = api.search_items("avi from:me type:video")
See the site for more info.
Todos:
* oAuth support
* Creating and getting MP4 Files
* File Uploading
* User Methods
"""
import sys
import socket
import urllib
import urllib2
try:
import json
except ImportError:
import simplejson as json
# setup
RPC_URL = "http://api.put.io/v1"
# constants
UNITS = ['B', 'K', 'M', 'G', 'T', 'P', 'E']
TIMEOUT = 60 #seconds
VERSION = "0.91"
# 0.92 transfers/add change
# 0.91 tidying up for the release; unicode human_size, user_idi user info
# bugs; some user, friend and item methods
# 0.90 updated auth, "v1"
# 0.85 reformated input and output. big changes on the api server.
# 0.84b typos
# 0.84 item_search to search_items, get_items orderby, get_friends
# 0.83 new stream url
def human_size(size):
"""
Converts bytes to human readable strings
Takes : An Integer
Returns: A String
Example:
>>> print human_size(12.66) # 12.7B
>>> print human_size(12345) # 12.1K
>>> print human_size(12345678) # 11.8M
>>> print human_size(12345678910) # 11.5G
>>> print human_size(12345678910111) # 11.2T
"""
if isinstance(size, unicode): size = int(size)
s = float(size * 1.0)
i = 0
while size >= 1024.00 and i < len(UNITS):
i += 1
size /= 1024.00
return "%.1f%s" % (size, UNITS[i])
def _send(obj, path, post=None, **args):
"""
Chats with API Server.
Takes : A dict.
Returns: JSON
To format the output, call _result() method.
Request Format:
{
"user_id" : INTEGER,
"api_key" : STRING,
"api_secret" : STRING,
"params" : DICTIONARY
}
Response Format:
{
"user_id" : INTEGER,
"response" : {
"results" : [{
.... data ....
}]
},
"error" :null,
"error_message" :null
}
"""
post_request = dict()
if not obj:
raise PutioError("You need to login first")
else:
post_request['api_key'] = obj.api_key
post_request['api_secret'] = obj.api_secret
url = RPC_URL + path
if args: url += "?" + urllib.urlencode(args)
# print url
# print "0. REQUEST: %s: %s" % (type(post), post)
post_request['params'] = dict()
for k in post.keys():
#if k not in ("user_id", "api_key", "api_secret"):
if k not in ("api_key", "api_secret"):
post_request['params'][k] = post[k]
else:
post_request[k] = post[k]
# print "POSTREQUEST: %s" % post_request
pre_post = {}
pre_post['request'] = json.dumps(post_request)
error_data = ""
try:
# print "1. POST: %s: %s" % (type(pre_post), pre_post)
request = urllib2.Request(url, urllib.urlencode(pre_post))
# default timeout time is 60 seconds.
socket.setdefaulttimeout(TIMEOUT)
if (sys.version_info[0] == 2 and sys.version_info[1] > 5) \
or sys.version_info[0] > 2:
u = urllib2.urlopen(request, timeout=TIMEOUT)
else:
u = urllib2.urlopen(request)
data = u.read()
# print "2. RECEIVED DATA: %s" % data
return _result(obj, data)
except urllib2.HTTPError, e:
error_data = e.read()
if e.code == 500:
raise PutioError("An error occured. This may be a bug. Please \
report to the application provider.", e)
elif e.code == 404:
raise PutioError("Unknown method, service or parameters.", e)
else:
raise PutioError("Service unavailable. Please try again.", e)
except urllib2.URLError, e:
raise PutioError("Request failed. (%s)" % str(e), e)
except UnboundLocalError, e:
raise PutioError("Service unavailable. This may be a bug on the api \
server side. Please report following info: (%s)" % str(e), e)
def _result(obj, data):
"""
Takes : JSON
Returns: A Dict
Checks if the api server returned an error or not.
Returns the error message or the success message.
JSON Format that API Server returns:
{
"error": false,
"error_message": null,
"user_id": some_integer,
"user_name": "username"
"response": {
"results": [ ...Always an array of things... ]
}
}
"""
try:
result = json.loads(data)
# print "3. RESULT DATA: %s" % result
except ValueError, e:
#logger.error('Error: %s' % e)
#logger.error('Data: %s' % data)
#logger.error('Result: %s' % result)
raise PutioError("Json error.", e)
# It's now a python dictionary. Json.loads() makes necessary
# conversions like "false" to "False", "null" to "None", etc.
# print "3. JSON TO DICT: ", result
if result['error'] is False:
obj.user_name = result['user_name']
obj.user_id = result['id']
return result['response']['results']
else:
#raise PutioError(result['error_message'])
return None
def strip_tags(value):
"""
Return the given HTML with all tags stripped.
You may use this to strip the html tags from
Put.io Dashboard Messages. (Optional)
Usage:
print strip_tags(MessageInstance.title)
"""
import re
return re.sub(r'<[^>]*?>', '', value)
class BaseObj(object):
# Creates an object with given dictionary.
def __init__(self, dictionary=None, **args):
if dictionary:
self.__dict__ = dictionary
if len(args) > 0:
for k,v in args.iteritems():
self.__dict__[k] = v
# def __getattr__(self, k):
# return self.__dict__[k]
def _convert_to_string(self):
if self.__dict__.has_key('file_type'):
self.file_type = Item._int_to_filetype(self.file_type)
if self.__dict__.has_key('dl_handler'):
self.dl_handler = UrlBucket.dl_handler[str(self.dl_handler)]
if self.__dict__.has_key('dltype'):
self.dltype = UrlBucket.dltype[str(self.dltype)]
class PutioError(Exception):
"""
PutioError Exception Class
"""
def __init__(self, message='', original=None):
self.message = message
self.original = original
def __str__(self):
if self.original:
original_name = type(self.original).__name__
return '%s (Original Exception: %s, "%s")' % (self.message,
original_name,
self.original.args)
else:
return self.message
class User(BaseObj):
"""
Sample user:
u.name : 'aft'
u.friends_count : 497
u.bw_avail_last_month : '0'
u.bw_quota : '161061273600'
u.shared_items : 3
u.bw_quota_available : '35157040261'
u.disk_quota : '206115891200'
u.disk_quota_available : '158153510402'
u.shared_space : 0
"""
def __init__(self, api, dictionary=None, **args):
BaseObj.__init__(self, dictionary, **args)
self.api = api
class Friend(BaseObj):
"""
Sample friend
f.dir_id : '1407'
f.id : '2'
f.name : 'hasan'
"""
def __init__(self, api, dictionary=None, **args):
BaseObj.__init__(self, dictionary, **args)
self.api = api
def get_items(self, **args):
"""
Takes : A friend instance
Returns: A List of item objects.
Shortcut for listing a friends shared items.
"""
return self.api.get_items(parent_id = self.dir_id, **args)
class Message(BaseObj):
"""
Dashboard message objects.
Message Methods:
message.delete()
Message Attributes:
message.id (Integer)
message.user_id (Integer)
message.title (String)
message.description (None)
message.importance (Integer)
message.file_name (String)
message.file_type (String)
message.user_file_id (Integer)
message.from_user_id (Integer. If None, message is from Put.io)
message.channel (Integer)
message.hidden (Integer, 1 or 0)
Sample:
user_file_id = 4
user_id = 17
description = None
title = '<a rel="userfile" href="/file/4">abcd.mp4
</a> <span class="dash-gray">(89.86K)
downloaded</span>'
importance = 0
file_name = 'abcd.mp4'
id = 3773
file_type = 'audio'
hidden = 0
from_user_id = None
channel = 2
"""
def __init__(self, api, dictionary=None, **args):
BaseObj.__init__(self, dictionary, *args)
self.file_type = Item._int_to_filetype(self.file_type)
self.api = api
def delete(self):
"""
Deletes messages. Returns none if unsuccessful.
"""
args = {"id":self.id}
result = _send(self.api, path="/messages", post=args, method="delete")
if not result: return None
class Api(object):
"""
A python interface into the Put.io API
Example usage:
To create an instance of the putio.Api class, with authentication:
>>> from putio import *
>>> api = api(YOUR_API_KEY, YOUR_API_SECRET)
To get the list of your files:
>>> items = api.get_items()
>>> for i in items: print i.id, i.name
To get the item list in a specified folder:
>>> items = api.get_items(id=123)
>>> for i in items: print i.id, i.name
Api Methods:
api.get_items()
api.get_transfers()
api.get_user()
api.is_ready()
api.create_folder()
api.search_items()
api.get_messages()
api.create_subscription()
api.get_subscription()
api.get_folder_list()
api.update_user_token()
api.get_user_info()
api.create_bucket()
"""
def __init__(self, api_key, api_secret):
self.user_id = None
self.user_name = None
self.access_token = None
self.api_key = api_key
self.api_secret = api_secret
# Token is required only for streaming links
self.access_token = self._get_user_token()
self.api = self
def update_user_token(self):
"""
Before streaming a video/audio file, its best to update the token.
This method doesn't return anything. It just updates the Api instance.
"""
self.access_token = self._get_user_token()
def get_user_name(self):
"""
Takes : Nothing
Returns: A String
Returns the name of the authenticated user. You can use this to
welcome your user.
"""
return self.user_name
def is_ready(self):
"""
Takes : Nothing.
Returns: True or False
Checks if the authentication is successful. Returns False if it isn't.
Probably, you won't be using this much.
Example:
>>> api = Api("key", "secret")
>>> if api.is_ready(): print "Vuhuu!"
"""
try:
return self.user_name
except:
return None
def get_items(self, limit=20, offset=0, parent_id=0, **arguments):
"""
Takes : Item attributes [Optional]
Returns: An Array of Item objects
Example:
>>> import putio
>>> api = putio.Api(YOUR_API_KEY, YOUR_API_SECRET)
>>> items = api.get_items() #without an argument
>>> items = api.get_items(type="video") #with an argument
>>> for i in items: print i.name, i.id, i.type
You can use these optional parameters while selecting item(s):
id = STRING or INTEGER
parent_id = STRING or INTEGER
offset = INTEGER (Default:0)
limit = INTEGER (Default: 20)
type = STRING (See Item class for available types)
orderby = STRING (Default: createdat_desc)
Orderby parameters:
id_asc
id_desc
type_asc
type_desc
name_asc
name_desc
extention_asc
extention_desc
createdat_asc
createdat_desc (Default)
See Item Class doc for the available attributes.
"""
items = []
args = {"limit":limit, "offset":offset, "parent_id":parent_id}
for k,v in arguments.iteritems(): args[k] = v
if "type" in arguments:
args['type'] = Item._filetype_to_int(arguments["type"])
result = _send(self.api, path="/files", post=args, method="list")
if result:
self.update_user_token()
for r in result:
items.append(Item(self.api, r))
return items
else:
raise PutioError("You have no items to show.")
def get_transfers(self):
"""
Takes : Nothing
Returns: An Array of Transfer objects
Example:
>>> trans = api.get_transfers()
>>> if newtransfers:
>>> for t in newtransfers:
>>> print t.name, t.status, t.percent_done
>>> else: print "you have no active transfers"
See Transfer Class doc for the available attributes.
"""
transfers = []
args = {}
transferlist = _send(self, path="/transfers", post=args, method="list")
if len(transferlist) > 0:
for k in transferlist:
transfers.append(Transfer(self.api, k))
return transfers
else:
return None
raise PutioError('You have no active transfers at the moment.')
def create_folder(self, name="New Folder", parent_id=0):
"""
Takes : A String [Optional], and
An Integer [Optional]
Returns: A Single Item object if successful.
Example:
>>> newfolder = api.create_folder(name="Created by Api")
>>> if newfolder: print "%s is created." % newfolder.name
"""
args = {"name":name, "parent_id":parent_id}
newfolder = _send(self.api,
path="/files",
post=args,
method="create_dir")
if newfolder and isinstance(newfolder, list):
newfolder = newfolder[0]
newfolder['id'] = int(newfolder['id'])
return Item(self.api, newfolder)
else:
#raise PutioError('Folder could not be created.')
return None
def search_items(self, query):
"""
Takes : A String
Returns: An Array of Item objects
Returns search results. You may add search parameters to the string
such as:
"from:'me'" (from:shares|jack|all|etc.)
"type:'video'" (audio|image|iphone|all|etc.)
"ext:'mp3'" (avi|jpg|mp4|all|etc.)
"time:'today'" (yesterday|thismonth|thisweek|all|etc.)
Example:
>>> searchresults = api.search_items("'jazz' from:'me' type:'audio'")
>>> if searchresults:
>>> for sr in searchresults: print sr.name
"""
search_results = []
args = {"query":query}
result = _send(self, path="/files", post=args, method="search")
if result:
self.update_user_token()
for r in result: search_results.append(Item(self.api, r))
return search_results
else:
return None
def get_messages(self):
"""
Takes : Nothing
Returns: An Array of Message objects
Returns your dashboard messages.
Example:
>>> msgs = api.get_messages()
>>> if msgs:
>>> for m in msgs: print m.title
"""
messages = []
args = {}
result = _send(self, path="/messages", post=args, method="list")
if result:
for r in result: messages.append(Message(self.api, r))
return messages
else:
return None
def create_subscription(self, name="My LegalTorrents Subscription",
url="http://www.legaltorrents.com/rss.xml",
**arguments):
"""
Takes : A String for name, a string for URL, and optional args.
Returns: A Single Subscription object
Creates a new subscription and returns it.
Example:
>>> newsub = api.create_subscription(name="Mininova",
url="http://www.mininova.org/rss.xml")
>>> if newsub: print "%s created." % newsub.name
See Subscription Class for available attributes
"""
args = {"title":name, "url":url}
for k in arguments.keys(): args[k] = arguments[k]
result = _send(self, path="/subscriptions", post=args, method="create")
if result:
return Subscription(self.api, result[0])
else:
return None
def get_subscriptions(self, **arguments):
"""
Takes: Nothing
Returns: An Array of Subscription objects
Returns a list of your subscriptions.
Example:
>>> subs = api.get_subscriptions()
>>> if newsub:
>>> for s in subs: print subs.name
See Subscription Class for available attributes
"""
subscriptions = []
args = {}
result = _send(self, path="/subscriptions", post=args, method="list")
if len(result) > 0:
for r in result:
if len(arguments) > 0:
for k,v in arguments.iteritems():
if r[k] == v:
subscriptions.append(Subscription(self.api, r))
else:
subscriptions.append(Subscription(self.api, r))
return subscriptions
else:
return None
def get_folder_list(self):
"""
Takes : Nothing
Returns: An Array of item objects.
Notice that this method returns a flat list of your folders. Create
your own method if you need a tree like list.
Parent_id is id of the container folder
Example:
>>> folderlist = api.get_folder_list()
>>> if folderlist:
>>> for f in folderlist: print f.name
Here is the returned item before being processed:
{
u'dirs': [...{sub folder 1}, {sub folder 2}...], # or []
u'shared': None,
u'id': u'4220',
u'name': u'renamed (4)',
u'default_shared': None
}
See Folder Class for available attributes
"""
folders = []
args = {}
result = _send(self, path="/files", post=args, method="dirmap")
# flattens the folder list
def recursive(folderarray):
if len(folderarray['dirs']) > 0:
for fa in folderarray['dirs']:
folders.append(Folder(self.api, fa))
recursive(fa)
else: folders.append(Folder(self.api, folderarray))
if result:
for r in result['dirs']:
if len(r['dirs']) > 0:
recursive(r)
else: folders.append(Folder(self.api, r))
return folders
else:
return None
def get_user_info(self):
"""
Takes : Nothing
Returns: A Single User object if successful.
Gives information about the authenticated user. Use this to inform
user about its quotas, sharing size, current available space, etc.
All sizes are in bytes. Use human_size(byte) to convert if necessary.
Returned Attributes:
info.bw_quota
info.disk_quota
info.bw_quota_available
info.disk_quota_available
info.name
info.shared_space
info.friends_count
info.shared_items
"""
args = {}
result = _send(self, path="/user", post=args, method="info")[0]
if result:
return User(self.api, result)
else:
return None
def _get_user_token(self):
"""
Internal method for getting the user token.
"""
args = {}
result = _send(self, path="/user", post=args, method="acctoken")
if result:
return result['token']
def get_friends(self):
"""
Takes : Nothing
Returns: An Array of Friend objects
Returns friends of the authenticated user.
Friend attributes:
friend.id
friend.name
friend.dir_id
Example:
>>> friends = api.get_friends()
>>> if friends:
>>> for f in friends: print f.name
To get a friend's files, use dir_id as a parent_id with get_items()
Option 1:
>>> for f in friends:
>>> items[f] = api.get_items(parent_id=f.dir_id)
>>> for i in items['jack']: print i.name
Option 2:
>>> for f in friends:
>>> f_items = f.get_items(limit=1)
>>> for fi in f_items: print fi.name
Returns None if the friend has no items.
"""
friends = []
args = {}
result = _send(self, path="/user", post=args, method="friends")
if result:
for r in result: friends.append(Friend(self.api, r))
return friends
else:
return None
def create_bucket(self):
"""
Takes : Nothing
Returns: An empty bucket object.
You'll need buckets to analyze and fetch URLs. Bucket is basicly a
container of one or more URLs, which then you can analyze and make
Put.io fetch the successfully analyzed URLs.
To fetch some URLs, you'll need to:
* Create a bucket (or use already existing one)
* Use Add method to add some URLs to the bucket
* Make Put.io analyze the bucket
* Add more or delete some of them
* And make Put.io fetch the URLs in the bucket.
After the analyzation, you can get a report about the bucket content
and the user quotas. For this, use get_report() method of UrlBucket
class.
"""
return UrlBucket(self.api)
class Item(BaseObj):
"""
An item can be a file or a folder.
Avaiable Item methods are:
item.rename_item()
item.move_item()
item.delete_item()
item.update_info()
item.get_download_url()
item.get_zip_url()
item.get_stream_url()
Available Item attributes:
Sizes are in bytes. Use human_size(byte) to convert if necessary.
item.id
item.name
item.type
item.size
item.is_dir
item.parent_id
item.screenshot_url
item.thumb_url
item.file_icon_url
item.download_url
Example Folder Item:
"id":"4394",
"name":"Billie Ray Martin The Crackdown Project - Vol 1",
"type":"folder",
"size":"23472048",
"is_dir":true,
"parent_id":"0",
"screenshot_url":"http://put.io/screenshot/b/dgRraFxlXmNl.jpg",
"thumb_url":"http://put.io/screenshot/dgRraFxlXmNl.jpg",
"file_icon_url":"http://put.io/images/file_types/folder.png",
"folder_icon_url":"",
"download_url":"http://node2.endlessdisk.com/download-file/17/4394",
"zip_url":"/stream-basket/17/4394"}
at the moment, type can be a:
folder
file
audio