Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- from aiovk import API, ImplicitSession
- from time import sleep
- async def anticomments():
- print ("Enter login:")
- login = input()
- print ("Enter password:")
- password = input()
- print ("Enter app id:")
- app_id = input()
- session = ImplicitSession(login, password, app_id, ['photos', 'video', 'wall', 'groups'])
- await session.authorize()
- api = API(session)
- user_var = await api.users.get()
- user_id = user_var[0]['id']
- while True:
- comments = await api.newsfeed.getComments(count = 100, start_time=1262307661, last_comments_count=0)
- if comments['items'] == []:
- break
- for i in comments['items']:
- offset = 0
- if i['type'] == 'topic':
- while True:
- topic = await api.board.getComments(group_id=i['source_id']*-1, topic_id=i['post_id'], offset=offset, count=100)
- sleep(2)
- if topic['items'] == []:
- offset = 0
- await api.newsfeed.unsubscribe(type=i['type'], item_id=i['source_id'])
- break
- for j in topic['items']:
- if j['from_id'] == user_id:
- await api.board.deleteComment(group_id=i['source_id']*-1, topic_id=i['post_id'], comment_id=j['id'])
- sleep(2)
- offset = offset + 100
- if i['type'] == 'post':
- while True:
- post = await api.wall.getComments(owner_id=i['source_id'], post_id=i['post_id'], offset=offset, count=100)
- sleep(2)
- if post['items'] == []:
- offset = 0
- await api.newsfeed.unsubscribe(type=i['type'], item_id=i['source_id'])
- break
- for j in post['items']:
- if j['from_id'] == user_id:
- await api.wall.deleteComment(owner_id=i['source_id'], comment_id=j['id'])
- sleep(2)
- offset = offset + 100
- if i['type'] == 'photo':
- while True:
- photo = await api.photos.getComments(owner_id=i['source_id'], photo_id=i['post_id'], offset=offset, count=100)
- sleep(2)
- if photo['items'] == []:
- offset = 0
- await api.newsfeed.unsubscribe(type=i['type'], item_id=i['source_id'])
- break
- for j in photo['items']:
- if j['from_id'] == user_id:
- await api.photos.deleteComment(owner_id=i['source_id'], comment_id=j['id'])
- sleep(2)
- offset = offset + 100
- if i['type'] == 'video':
- while True:
- videos = await api.video.getComments(owner_id=i['source_id'], video_id=i['post_id'], offset=offset, count=100)
- sleep(2)
- if videos['items'] == []:
- offset = 0
- await api.newsfeed.unsubscribe(type=i['type'], item_id=i['source_id'])
- break
- for j in videos['items']:
- if j['from_id'] == user_id:
- await api.video.deleteComment(owner_id=i['source_id'], comment_id=j['id'])
- sleep(2)
- offset = offset + 100
- session.close()
- loop = asyncio.get_event_loop()
- loop.run_until_complete(anticomments())
Advertisement
Add Comment
Please, Sign In to add comment