Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*-coding:u8-*-
- from vklib import *
- from utils import *
- from account import *
- vk=VKClient(delay_time=1)
- vk.login(username, password)
- def save_album(album_url, target_album_id):
- m = re.search('album([^_]+)_(\d+)', album_url)
- # print m.groups()
- oid = m.group(1)
- aid = m.group(2)
- sys_albums={'0': 'profile', '00': 'wall', '000': 'saved'}
- if aid in sys_albums:
- aid = sys_albums[aid]
- o = 0
- c = 1000
- print album_url
- while 1:
- r = vk.api('photos.get', rev=1, owner_id=oid, album_id=aid, offset=o, count=c)
- print '%s/%s' % (o, r['count'])
- for it in r['items']:
- try:
- photo_id = vk.api('photos.copy', owner_id=oid, photo_id=it['id'])
- vk.api('photos.move', target_album_id=target_album_id, photo_id=photo_id)
- except Exception, e:
- print e
- o += c
- if o >= r['count']:
- break
- links = [
- 'https://vk.com/album-16237051_129232048'
- ]
- my_album = 203817625
- for link in links:
- try:
- save_album(link, my_album)
- except Exception, e:
- print e
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement