VK Getter
Very simple and pythonic way to extract data from VK.
Getting started
Install package via pip
pip install vk_getter
Use your access token, and get posts from any public group. You can get token here.
from vk_getter import VKGetter
getter = VKGetter("TOKEN")
posts = getter.get_posts("vk", 200)
posts = getter.get_posts("lol", 150, 50)
You can specify different settings:
posts = getter.get_latest_posts("https://www.vk.com/vk",
count=120,
offset=20,
pinned=False,
allow_no_attachments=False,
ads=False,
copyright=False)
All posts are retrieved as a Python dataclasses, but can also be returned as dicts.
posts = getter.get_latest_posts(group_domain="vk",
count=1,
as_dict=True)
Attachments
You can download gathered attachments to your local system.
from vk_getter import VKGetter
getter = VKGetter("TOKEN")
posts = getter.get_posts("lol", 150)
path = "lol"
getter.download_all(posts, path)
getter.download(posts, "photo", path)
getter.download(posts, "video", path)
getter.download(posts, "audio", path)
getter.download(posts, "other", path)
Or you can extract them as links.
from vk_getter import VKGetter
getter = VKGetter("TOKEN")
posts = getter.get_posts("lol", 150)
attachments = getter.extract_all(posts)
photos = getter.extract(posts, "photo")
videos = getter.extract(posts, "video")
audios = getter.extract(posts, "audio")
others = getter.extract(posts, "other")
*Note:
do NOT use as_dict
in the get_posts method.