phippsy / brandwatchr Goto Github PK
View Code? Open in Web Editor NEWAccess the Brandwatch API from R. Poorly maintained as I no longer have a Brandwatch login, sorry.
License: Other
Access the Brandwatch API from R. Poorly maintained as I no longer have a Brandwatch login, sorry.
License: Other
Code being run:
brandwatchR::bwr_auth(un = "XXXX",
pw = "XXXX")
my_projects <- bwr_projects_get()
head(my_projects)
(my_project <- bwr_projects_get()$id)
(my_query <- bwr_query_get(project_id = my_project)$id)
bwr_query_create(project_id = my_project,
samplePercent = 50,
includedTerms = 'at_mentions:mickeymouse',
name = 'test1')
output:
Error in bwr_query_create(project_id = my_project, samplePercent = 50, :
Bad Request (HTTP 400).
No issues until I run bwr_query_create
.
I was able to pull data for a specific project and query, and all other fields appear to pull successfully, but the snippet does not appear (it shows as NA). When I use a curl statement to pull the same data via the API, the snippets are successfully pulled.
Here is the sample of the code I am running
library(brandwatchR)
library(jsonlite)
library(dplyr)
library(lubridate)
bwr_auth(un = "#############@##############", pw = rstudioapi::askForPassword())
my_project <- bwr_projects_get()$id[2]
my_query <- bwr_query_get(project_id = my_project)$id[4] #4
my_mentions_test <- bwr_mentions_get(project_id = my_project,
query_id = my_query,
filters = list(gender = "female", sentiment = 'neutral'), #, twitterVerified = TRUE),
order_by = 'sentiment', order_direction = 'asc',
page = 0,
date_range = c('2019-01-30', '2019-01-31'))
I've been getting Error: Bad Request (HTTP 400)
each time I try to login. Has anyone else had this issue?
Hi,
When I run the following code:
bwr_mentions_get( project_id = 1998216861, query_id = 1999369154, page = 0)
It automatically tries to see/check the next page i.e. 1 in this case.
This throws an error:
No encoding supplied: defaulting to UTF-8. Error in vapply(x, obj_sum, character(1L)) : values must be length 1, but FUN(X[[1]]) result is length 0
After checking with the de-bugger:
here is the error:
if (dim(results)[1] >= 5000) { results <- data.table::rbindlist(list(results, bwr_mentions_get(project_id = project_id, query_id = query_id, date_range = date_range, page = json$resultsPage + 1)), fill = TRUE) }
Could we get it fixed please?
hi I am trying to pull some brandwatch mentions data with this package and everything seems to be working fine except in the data column a lot of values are coming up as NA. here is my code:
library(brandwatchR)
library(dplyr)
library(xlsx)
setwd("")
bwr_auth(un = "",
pw = "",
refresh = FALSE,
cache = FALSE)
View(bwr_cat_get(
project_id =
))
my_projects <- bwr_projects_get()
head(my_projects)
my_mentions1 <- bwr_mentions_get(
project_id = ,
query_id = ,
date_range = c("2019-04-01", "2019-08-12"))
my_mentions2 <- bwr_mentions_get(
project_id = ,
query_id = ,
date_range = c("2019-03-01", "2019-04-01"))
my_mentions3 <- bwr_mentions_get(
project_id = ,
query_id = ,
date_range = c("2019-01-20", "2019-03-01"))
my_mentions4 <- bwr_mentions_get(
project_id = ,
query_id = ,
date_range = c("2019-01-18", "2019-01-20"))
my_mentions5 <- bwr_mentions_get(
project_id = ,
query_id = ,
date_range = c("2019-01-17", "2019-01-18"))
my_mentions6 <- bwr_mentions_get(
project_id = ,
query_id = ,
date_range = c("2018-10-1", "2019-01-12"))
glimpse(my_mentions1)
library(dplyr)
my_mentions1 <- my_mentions1 %>%
as_tibble %>%
select(date, sentiment, categories)
my_mentions2 <- my_mentions2 %>%
as_tibble %>%
select(date, sentiment, categories)
my_mentions3 <- my_mentions3 %>%
as_tibble %>%
select(date, sentiment, categories)
my_mentions4 <- my_mentions4 %>%
as_tibble %>%
select(date, sentiment, categories)
my_mentions5 <- my_mentions5 %>%
as_tibble %>%
select(date, sentiment, categories)
my_mentions6 <- my_mentions6 %>%
as_tibble %>%
select(date, sentiment, categories)
my_mentions <- bind_rows(my_mentions1, my_mentions2, my_mentions3, my_mentions4, my_mentions5, my_mentions6)
write.csv(as.matrix(my_mentions), "mentions.csv")
(I have removed project/ query ID and name and password/ setwd)
The resulting CSV is a file with some dates, but most of them are filled with NA.
Any help would be really appreciated!
Congrats on new package!
Small error here when I try to view the my_groups
dataframe:
#install.packages('brandwatchR')
library(brandwatchR)
library(jsonlite)
library(dplyr)
brandwatch_credentials <- file.path("..", "credentials", "brandwatch.json")
bw <- jsonlite::fromJSON(brandwatch_credentials)
# Authenticate
bwr_auth(un= bw$USERNAME,
pw= bw$PASSWORD,
refresh = TRUE,
cache = TRUE)
# Get projects
my_projects <- bwr_projects_get()
#head(my_projects)
PROJECT <- my_projects %>% filter(name == bw$PROJECT) %>% pull(id)
# Get groups
my_groups <- bwr_querygrp_get(project_id = PROJECT)
View(my_groups)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.