VKExport позволяет экспортировать данные в файл JSON с личной страницы ВК или другого человека.
- Данных профиля users.get
- Документов docs.get
- Друзей friends.get
- Подарков gifts.get
- Заметок notes.get с комментариями notes.getComments
- Фотографий photos.get с комментариями photos.getAllComments
- Историй stories.get
- Видео video.get с комментариями video.getComments
- Подписчиков users.getFollowers
- Групп и публичных страниц groups.get
- Маркета (магазина) market.get
- Постов на стене wall.get с комментариями wall.getComments
- Сообщений messages.getById
- Скачайте скрипт
- Установите пакеты, используя команду
pip install -r requirements.txt
- Запустите скрипт, используя команду
python collector.py VK_TOKEN durov -api 5.82 -c wall,photos,notes -sf -v
Команда python collector.py -h
показана ниже
usage: collector.py [-h] [-c CUSTOM | -b | -e | -f] [-a API] [-sf] [-v]
token id
usage: collector.py VK_TOKEN durov -api 5.82 -c wall,photos,notes -sf -v
positional arguments:
token VK API token
id Page ID or user domain
options:
-h, --help show this help message and exit
-c CUSTOM, --custom CUSTOM
Parse custom methods
-b, --base Parse basic info
-e, --extra Parse basic + extra info
-f, --full Parse full info
-a API, --api API API version
-sf, --singlefile Save result in single file
-v, --verbose Increase output verbosity
token
- Токен VK API
id
— идентификатор или домен страницы (например, 1
, id1
или durov
)
-a, --apiver
— версия API VK, например 5.82
. Default: 5.82
-sf, --singlefile
- Сохранение результата в одном файле. По умолчанию, каждый метод сохраняется в отдельный файл
-b, --base
— Базовый уровень парсера. Парсинг всех методов, кроме messages.getById и users.getFollowers
-e, --extra
— Средний уровень парсера. Парсинг всех методов, кроме messages.getById
-f, --full
— Полный уровень парсера. Парсинг всех представленных методов
-v, --verbose
— Показать подробности
-c, --custom
— Выбрать собственные методы. Например, при photos,wall
будет использован парсинг только photos.get и wall.get
Сервис vkhost.github.io позволяет в автоматическом режиме собрать URL и получить токен
- Откройте vkhost.github.io
- Выберите приложение. Например, можно выбрать Kate Mobile или VFeed
- Нажмите на выбранное приложение
- Нажмите на "Продолжить как" или "Разрешить"
- Скопируйте часть URL начиная с
access_token=
и заканчивая&expires_in
- Вставьте токен в скрипт
Также можно использовать другие приложения или службы для получения токена.
После использования скрипта, в целях безпопасности КРАЙНЕ рекомендуется удалить API токен. Это можно сделать двумя способами: отозвать права на используемое приложения для токена, либо сменить пароль
Получить ключ доступа пользователя можно одним из этих способов:
-
Implicit Flow: для работы с API от имени пользователя в Javascript-приложениях и Standalone-клиентах (десктопных или мобильных).
-
Authorization Code Flow: для работы с API от имени пользователя с серверной стороны вашего сайта.
Дополнительную информацию можно найти в Общих сведениях
ПРИМЕЧАНИЕ: Если JSON файл слишком большой, есть вероятность получить ошибку MemoryError. Чтобы исправить это, установите x64 версию Python
VKExport allows you to export data in JSON file from personal or other VK pages
- Profile data users.get
- Documents docs.get
- Friends friends.get
- Gifts gifts.get
- Notes notes.get with comments notes.getComments
- Photos photos.get with comments photos.getAllComments
- Stories stories.get
- Videos video.get with comments video.getComments
- Followers users.getFollowers
- Groups, public pages groups.get
- Market items market.get
- Wall posts wall.get with comments wall.getComments
- Messages messages.getById
- Download script
- Install packages using
pip install -r requirements.txt
- Run script using
python collector.py VK_TOKEN durov -api 5.82 -c wall,photos,notes -sf -v
The command python collector.py -h
is shown below
usage: collector.py [-h] [-c CUSTOM | -b | -e | -f] [-a API] [-sf] [-v]
token id
usage: collector.py VK_TOKEN durov -api 5.82 -c wall,photos,notes -sf -v
positional arguments:
token VK API token
id Page ID or user domain
options:
-h, --help show this help message and exit
-c CUSTOM, --custom CUSTOM
Parse custom methods
-b, --base Parse basic info
-e, --extra Parse basic + extra info
-f, --full Parse full info
-a API, --api API API version
-sf, --singlefile Save result in single file
-v, --verbose Increase output verbosity
token
- VK API Token
id
- ID or Page domain (e.g. 1
, id1
or durov
)
api APIVER, --apiver APIVER
- VK API Version, eg 5.82
-sf, --singlefile
- Save result in single file. Each file for method by default.
-m [{1,2,3}], --mode [{1,2,3}]
- Parser complexity. 1
parses all except messages and followers, 2
parses all except messages, 3
parses all methods
-b, --base
— Base parser complexity, instead messages.getById and users.getFollowers
-e, --extra
— Extra parser complexity, instead messages.getById
-f, --full
— Full parser complexity. Parsing all methods
-v, --verbose
— Показать подробности
-v, --verbose
- Increase output verbosity
-c, --custom
- Set custom methods, e.g. photos,wall
will parse photos.get and wall.get
Service vkhost.github.io helps automatically bulid URL and get token
- Visit vkhost.github.io
- Choose app. It's better to use token from Kate Mobile or VFeed apps
- Click on app
- Click on "Continue as" or "Allow"
- Copy part of URL from
access_token=
to&expires_in
- Paste token to CLI
You can use other apps or services to get token.
After using the script for security reasons, it is HIGHLY recommended to remove the API token. It is possible to do in two ways: revoke app authorization which was used to obtain token, or change the password
To get api token you can use one of them ways:
-
Implicit Flow: to work with API on behalf of the user in Javascript applications and Standalone clients (desktop or mobile).
-
Authorization Code Flow: to work with API on behalf of the user from the server side of your site.
You can find extra information at General information