Advertisement
stuppid_bot

Untitled

Jun 17th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.27 KB | None | 0 0
  1. # -*- coding: utf8 -*-
  2. from darth import *
  3. from random import choice
  4. from time import sleep
  5.  
  6. album_id = 197002724
  7. photo_ids = []
  8. o = 0
  9. l = 1000
  10. while 1:
  11.     r = vk.api('photos.get', {'album_id': album_id, 'offset': o, 'count': l})
  12.     photo_ids += [item['id'] for item in r['items']]
  13.     o += l
  14.     if o >= r['count']:
  15.         break
  16. print u'Фоточек: %s' % len(photo_ids)
  17. group_ids = [
  18.     # 59921851,
  19.     # 51609737,
  20.    
  21.     47350356,  
  22.     42416529,
  23.     19814678,
  24.     39130136,
  25.     # 39410357,
  26.     39673900,
  27.     38518878,
  28.     # 30127198, # стена закрыта
  29.    
  30.     # 65420545,
  31.     # 41258869,
  32.     # 24261502,
  33.     # 34985835,
  34.     # 46039830,
  35.    
  36.     36352266,
  37.     17164406,
  38.    
  39.     # 23206079,
  40.     # 8337923,
  41.    
  42.     31234562,
  43.     52805991,
  44.     44339426,
  45.     24045232,
  46.     56028682,
  47.     39228798,
  48.     16526901,
  49.     52651103,
  50.     33704965,
  51.     28304846,
  52.     59721672,
  53.     55940002,
  54.     61831751,
  55.     # 55897568,
  56.     # 50794393,
  57. ]
  58. queue = []
  59. while 1:
  60.     vk.api('account.setOnline')
  61.     r = vk.api('friends.getRequests')
  62.     print 'requests: %s' % r['count']
  63.     for user_id in r['items']:
  64.         params = {'user_id': user_id}
  65.         code = vk.api('friends.add', params)
  66.         # отменил заявку
  67.         if code != 2:
  68.             vk.api('friends.delete', params)
  69.         else:
  70.             # лайкаем фотки с авки, но не более 3
  71.             # r = vk.api('photos.getProfile', {'owner_id': user_id, 'count': 3, 'rev': 1})
  72.             # L = [x['id'] for x in r['items']]
  73.             # for x in L:
  74.             #     vk.api('likes.add', {'owner_id': user_id, 'type': 'photo', 'item_id': x})
  75.             #     sleep(1)
  76.             pass
  77.     for group_id in group_ids:
  78.         print 'http://vk.com/club%s' % group_id
  79.         if len(queue) == len(group_ids):
  80.             owner_id, post_id = queue.pop(0)
  81.             vk.api('wall.delete', {'owner_id': owner_id, 'post_id': post_id})
  82.         owner_id = -group_id
  83.         r = vk.api('wall.post', {'owner_id': owner_id, 'attachments': 'photo%s_%s' % (vk.user_id, choice(photo_ids))})
  84.         # print u'Опубликовали http://vk.com/wall-%s_%s' % (group_id, r['post_id'])
  85.         queue.append((owner_id, r['post_id']))
  86.         sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement