Skip to content

Commit

Permalink
fixed bug in xml node parsing for athlind_fun
Browse files Browse the repository at this point in the history
  • Loading branch information
fawda123 committed Feb 26, 2020
1 parent f2590fc commit 86e44cd
Show file tree
Hide file tree
Showing 54 changed files with 204 additions and 193 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: rStrava
Type: Package
Title: Access the Strava API
Version: 1.1.2
Date: 2020-01-02
Version: 1.1.3
Date: 2020-02-26
Description: Functions to access data from Strava's v3 API.
LazyData: TRUE
BugReports: https://github.com/fawda123/rStrava/issues
Expand Down
9 changes: 6 additions & 3 deletions R/athlind_fun.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ athlind_fun <- function(athl_num){
url_in <- paste0('https://www.strava.com/athletes/', athl_num)

# get page data for athlete, parsed as list
prsd <- url_in %>%
xmlatt <- url_in %>%
read_html() %>%
rvest::html_nodes("[data-react-class]") %>%
xml_attr('data-react-props') %>%
V8::v8()$get(.)
xml_attr('data-react-props')

prsd <- V8::v8()
prsd$assign('xmlatt', V8::JS(xmlatt))
prsd <- prsd$get('xmlatt')

# exit if nothing found
if(is.null(prsd)){
Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,19 @@ athl_fun(2837007, trace = FALSE)
## 4 2019-10-01 48.97586 7 773
## 5 2019-11-01 165.17040 14 545
## 6 2019-12-01 124.46997 11 553
## 7 2020-01-01 0.00000 0 0
## 7 2020-01-01 18.50008 1 52
##
## $`2837007`$recent
## id name type startDateLocal distance elevation movingTime
## 1 2960494076 Lunch Run run 2019-12-27 3.2 158 24:51
## 2 2958411997 Afternoon Run run 2019-12-26 3.2 160 24:57
## 3 2955825575 Morning Run run 2019-12-25 3.2 161 24:50
## id name type startDateLocal distance elevation movingTime
## 1 2998245402 Morning Ride ride 2020-01-09 3.6 15 15:00
## 2 2997205625 Afternoon Ride ride 2020-01-09 3.8 62 16:35
## 3 2995517807 Morning Ride ride 2020-01-08 3.6 15 15:35
##
## $`2837007`$achievements
## description timeago
## 1 PR on Snell Bridge up 2019-12-15 18:04:34
## 2 PR on 21-9st Sprint 2019-12-05 15:09:05
## 3 2nd fastest time on 21-9st Sprint 2019-12-10 11:44:20
## 4 2nd fastest time on 9-21st Sprint 2019-12-05 21:40:46
## 2 2nd fastest time on 21-9st Sprint 2020-01-08 11:47:05
## 3 3rd fastest time on 9-21st Sprint 2020-01-09 22:42:26

### API functions (token)

Expand Down Expand Up @@ -155,6 +154,11 @@ The API retrieval functions are used with the token.

``` r
myinfo <- get_athlete(stoken, id = '2837007')
```

## Auto-refreshing stale OAuth token.

``` r
head(myinfo)
```

Expand Down Expand Up @@ -243,7 +247,7 @@ individual activities. Streams provide detailed information about
location, time, speed, elevation, gradient, cadence, watts, temperature,
and moving status (yes/no) for an individual activity.

Use `get_activity_streams` for detailed info about activites:
Use `get_activity_streams` for detailed info about activities:

``` r
# get streams for the first activity in my_acts
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

152 changes: 76 additions & 76 deletions docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/achievement_fun.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 58 additions & 54 deletions docs/reference/athl_fun.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/athlind_fun.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/chk_nopolyline.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/compile_activities.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/compile_activity.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/compile_activity_streams.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/compile_club_activities.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/compile_seg_effort.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/compile_seg_efforts.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/compile_segment.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/filter.actframe.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/get_KOMs.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/get_activity.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/get_activity_list.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/get_activity_streams.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 86e44cd

Please sign in to comment.