All Projects → Dementiy → vkR

Dementiy / vkR

Licence: other
Access to VK (Vkontakte) API via R

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to vkR

Vk4xmpp
Jabber-транспорт для ВКонтакте (A jabber gateway to the VK social network)
Stars: ✭ 114 (+111.11%)
Mutual labels:  vkontakte
Node Vk Bot Api
🤖 VK bot framework for Node.js, based on Bots Long Poll API and Callback API.
Stars: ✭ 195 (+261.11%)
Mutual labels:  vkontakte
dynamic-photo-vk
Смена изображений на фото ВКонтакте 20 раз в день
Stars: ✭ 19 (-64.81%)
Mutual labels:  vkontakte
Assent
Multi-provider framework in Elixir
Stars: ✭ 126 (+133.33%)
Mutual labels:  vkontakte
Vk Api Schema
JSON Schema of VK API
Stars: ✭ 158 (+192.59%)
Mutual labels:  vkontakte
Ngx Avatar
Universal avatar component for angular 2+ applications makes it possible to fetch / generate avatar from different sources
Stars: ✭ 210 (+288.89%)
Mutual labels:  vkontakte
Socialauthhelper
Easy social network authorization for Android. Supports Facebook, Twitter, Instagram, Google+, Vkontakte. Made by Stfalcon
Stars: ✭ 94 (+74.07%)
Mutual labels:  vkontakte
VideoforVk
Video for Vk (or VT) is client for Vk video API.
Stars: ✭ 27 (-50%)
Mutual labels:  vkontakte
Vk Requests
vk.com requests for humans. API library for vk.com
Stars: ✭ 162 (+200%)
Mutual labels:  vkontakte
django-sitemessage
Reusable application for Django introducing a message delivery framework
Stars: ✭ 51 (-5.56%)
Mutual labels:  vkontakte
Omniauth Vkontakte
Vkontakte OAuth2 Strategy for OmniAuth
Stars: ✭ 137 (+153.7%)
Mutual labels:  vkontakte
Vk Ruby
Ruby wrapper for vk.com API
Stars: ✭ 152 (+181.48%)
Mutual labels:  vkontakte
Swiftyvk
Easy and powerful way to interact with VK API for iOS and macOS
Stars: ✭ 247 (+357.41%)
Mutual labels:  vkontakte
Sketal
Бот для ВКонтакте. Беседы / группы / развлечения.
Stars: ✭ 119 (+120.37%)
Mutual labels:  vkontakte
vkbot
Chat-bot for vk.com
Stars: ✭ 22 (-59.26%)
Mutual labels:  vkontakte
Vk To Telegram Bot
Bot for auto-reposting posts from VK to Telegram channel
Stars: ✭ 103 (+90.74%)
Mutual labels:  vkontakte
Vkapiphp
[Abandoned] Library for work with API Vk.com
Stars: ✭ 206 (+281.48%)
Mutual labels:  vkontakte
pyscrapers
Scrapers for vk, facebook, instagram and more
Stars: ✭ 18 (-66.67%)
Mutual labels:  vkontakte
vue-socials
💬 Social media share buttons and counts for Vue.js
Stars: ✭ 32 (-40.74%)
Mutual labels:  vkontakte
vk-api
VK SDK | VKontakte wrapper for standalone apps
Stars: ✭ 30 (-44.44%)
Mutual labels:  vkontakte

Travis-CI Build Status CRAN_Status_Badge

vkR is an R package which provides access to the VKontakte (VK) API.

Installation

To get the current released version from CRAN:

install.packages("vkR")

To get the current development version from github:

install.packages("devtools")
devtools::install_github("Dementiy/vkR")
library("vkR")

Authorization

Most API requests require the use of an access token. VK has several types of authorization mechanisms. Check out the documentation for more details.

vkOAuth(CLIENT_ID, 'SCOPE', 'EMAIL', 'PASSWORD')

where:

  • CLIENT_ID - is an application ID. You have to create new Standalone-app in VK to get ID (or use the already existing).
  • SCOPE - the list of comma separated access rights, e.g. 'friends,groups'- provide the access to user friends and groups. List of all rights can be found here.
  • EMAIL and PASSWORD - username and password.

If the EMAIL and PASSWORD have been omitted, a browser window will be opened. In the address bar an access token will be shown. Access token must be copied and passed as an argument into the following function:

setAccessToken(access_token = 'YOUR ACCESS TOKEN')

Example of use

At your own risk you can use mongodb and mongolite package for storing data:

> db_init()
> wall <- getWallExecute(domain="data_mining_in_action", count=0, use_db=TRUE, progress_bar=TRUE)
|======================...======================| 100%
> show_collections()
    db            collection       suffix count
1 temp data_mining_in_action         wall   232

If connection was aborted by some reasons we don't lose our data:

> wall <- getWallExecute(domain='privivkanet', count=0, use_db = T, progress_bar = T)
|=================                              |  25%
Show Traceback
 
 Rerun with Debug
 Error in curl::curl_fetch_memory(url, handle = handle) : 
  Operation was aborted by an application callback ...
> show_collections()
    db            collection       suffix count
1 temp data_mining_in_action         wall   232
2 temp           privivkanet         wall   916
> wall <- getWallExecute(domain='privivkanet', count=0, offset=916, use_db = T, progress_bar = T)
|======================...======================| 100%
> show_collections()
    db            collection       suffix count
1 temp data_mining_in_action         wall   232
2 temp           privivkanet         wall  3664

You can specify the collection name:

> wall <- getWallExecute(domain="data_mining_in_action", count=0, 
        use_db=TRUE, db_params=list('collection'='dm', 'suffix'='posts'), progress_bar=TRUE)
|======================...======================| 100%
> show_collections()
    db            collection       suffix count
1 temp data_mining_in_action         wall   232
2 temp           privivkanet         wall  3664
3 temp                    dm        posts   232

> friends <- getFriends()
> users <- getUsersExecute(friends$items, use_db = TRUE, db_params=list('collection'='my_friends'), progress_bar = TRUE)
> show_collections()
    db            collection       suffix count
1 temp data_mining_in_action         wall   232
2 temp           privivkanet         wall  3664
3 temp                    dm        posts   232
4 temp            my_friends                141

For load collection into a namespace you can use db_load_collection function:

> db_load_collection('data_mining_in_action', 'wall')
 Imported 232 records. Simplifying into dataframe...
> ls()
[1] "temp.data_mining_in_action.wall"
> nrow(temp.data_mining_in_action.wall)
[1] 232

Building a Friend Graph:

my_friends <- getFriends(fields = 'sex')
my_friends <- filter(my_friends$items, is.na(deactivated))
network <- getNetwork(my_friends$id)

library("igraph")
g <- graph.adjacency(as.matrix(network), weighted = T, mode = "undirected")
layout <- layout.fruchterman.reingold(g)
plot(g, layout = layout)

Analyzing community activity:

domain <- 'nipponkoku'
wall <- getWallExecute(domain = domain, count = 0, progress_bar = TRUE)
metrics <- jsonlite::flatten(wall$posts[c("date", "likes", "comments", "reposts")])
metrics$date <- as.POSIXct(metrics$date, origin="1970-01-01", tz='Europe/Moscow')

library(dplyr)
df <- metrics %>% 
  mutate(period = as.Date(cut(date, breaks='month'))) %>% 
  group_by(period) %>%
  summarise(likes = sum(likes.count), comments = sum(comments.count), reposts = sum(reposts.count), n = n())

library(ggplot2)
library(tidyr)
ggplot(data=gather(df, 'type', 'count', 2:5), aes(period, count)) + geom_line(aes(colour=type)) +
  labs(x='Date', y='Count')

Coomunity activity

You can find more examples in examples directory.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].