Giter VIP home page Giter VIP logo

rahrefs's People

Contributors

leszek-sieminski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rahrefs's Issues

assert_that optimisation?

Really useful library thanks, I was just looking through it and saw this:

RAhrefs/R/downloader.R

Lines 113 to 138 in 7132390

assertthat::assert_that(!is.null(target))
assertthat::assert_that(!is.na(target))
assertthat::is.string(target)
assertthat::assert_that(
grepl("\\.", target),
msg = "No dot ('.') is detected in parameter 'target'. Is it a proper URL address?")
# safety net: report --------------------------------------------------------
assertthat::assert_that(!is.null(report))
assertthat::assert_that(!is.na(report))
assertthat::is.string(report)
assertthat::assert_that(report %in% report_vector)
# safety net: token ---------------------------------------------------------
assertthat::assert_that(!is.null(token))
assertthat::assert_that(!is.na(token))
assertthat::is.string(token)
assertthat::assert_that(
nchar(token) > 30,
msg = "'token' parameter is too short. Is your API token correct?")
# safety net: mode ----------------------------------------------------------
assertthat::assert_that(!is.null(mode))
assertthat::assert_that(!is.na(mode))
assertthat::is.string(mode)
assertthat::assert_that(mode %in% mode_vector)

...which I think won't perform as you intend. The assertthat conditions need to be within assert_that() to trigger errors, so assertthat::is.string(target) just returns TRUE or FALSE rather than an error. Also could list several in one condition.

Also to save writing out assertthat:: all the time, you can use #' @import assertthat in the boilerplate.

As a suggestion:

#' @import assertthat

..snip..

assert_that(!is.null(target),
                   !is.na(target),
                    is.string(target),  # this will trigger an error now, doesn't as is
                    is.string(report),
                    !is.null(report),
                    etc...
) 

Issues accessing to data

First of all thanks for your help!

I'm trying to connect to ahrefs API using r. I have found your library and it did work to see the available reports and libraries. Now I would like to perform a basic query but I receive different errors:
ERROR 1 (the url and token has been omited)
RAhrefs::rah_backlinks (target = "domain.com/path/path",
token = Sys.getenv("token"),
mode = "exact", metrics = "url_from")

Error: nchar(token) not greater than 30

ERROR 2 (if i delete the token, then i get a different error, it seems is requesting the token)
RAhrefs::rah_backlinks (target = "domain.com/path/path",
mode = "exact", metrics = "url_from")

Error in do.call(rbind.data.frame, data_list$refpages) :
second argument must be a list

Not able to find out the domain rating and URL rating for a site other than "Ahref.com"

Dear Leszek,

When I am trying to run below code chunk using "RAhrefs" package written by you.
Code runs well when the target is any Ahref url but gives internal billing error in output if I change URL to any other URL.

#target <- 'ahrefs.com'
target <- 'andrewgoldner.com'
temp <- rah_domain_rating(target, token = Sys.getenv("AHREFS_AUTH_TOKEN"),
mode = "domain", metrics = NULL, limit = 1000, order_by = NULL,
where = NULL, having = NULL)

Could you please help me with this?

Thanks in Advance,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.