You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.5 KiB

---
output:
md_document:
variant: markdown_github
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r options, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
![](longurl.png)

[![Build Status](https://travis-ci.org/hrbrmstr/longurl.svg)](https://travis-ci.org/hrbrmstr/longurl)
<!-- ![Project Status: Concept - Minimal or no implementation has been done yet.](http://www.repostatus.org/badges/0.1.0/concept.svg)](http://www.repostatus.org/#concept) -->
<!-- [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/longurl)](http://cran.r-project.org/web/packages/longurl)
<!-- ![downloads](http://cranlogs.r-pkg.org/badges/grand-total/longurl) -->

longurl : Expand Short URLs using the 'LongURL' API

This does a bit more than [decode_short_url](https://github.com/geoffjentry/twitteR/blob/master/R/utils.R#L22-L31) from the [twitteR](https://github.com/geoffjentry/twitteR) package since it:

- enables you to get a list of what shortening services [longurl](http://longurl.org/) knows about
- has an option to do a post-expand check with a `HEAD` request to ensure the resource exists (useful when you think longurl just failed to expand)
- has an option to warn on expansion issues
- has an option for progress bars
- works with a vector of URLs
- returns `data_frame`s

The following functions are implemented:

- `expand_urls`: Expand a vector of (short) URLs using the longurl service
- `known_services`: Retrieve all the URL shortener services known to the longurl API

The following data sets are included:

### News

- Version `0.0.0.9000` released

### Installation

```{r install, eval=FALSE}
devtools::install_github("hrbrmstr/longurl")
```

```{r options_2, echo=FALSE, message=FALSE, warning=FALSE, error=FALSE}
options(width=200)
```

### Usage

```{r usage}
library(longurl)
library(dplyr)

# current verison
packageVersion("longurl")

test_urls <- c("http://t.co/D4C7aWYIiA",
"1.usa.gov/1J6GNoW",
"ift.tt/1L2Llfr",
"bit.ly/1GPr5w5",
"http://l.dds.ec/1da152x",
"http://l.rud.is/seven")

head(expand_urls(test_urls), 2)

svcs <- known_services()
filter(svcs, regex != "")
```

### Test Results

```{r test}
library(longurl)
library(testthat)

date()

test_dir("tests/")
```

### Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.