-
Notifications
You must be signed in to change notification settings - Fork 0
/
timetable-scrape.R
79 lines (61 loc) · 1.69 KB
/
timetable-scrape.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#### Set-Up ####
# packages:
library(fs)
library(tidyverse)
library(rvest)
library(xml2)
# data:
timetable <- path_wd("Timetable. Fitness Classes London _ Third Space.html") %>%
read_html()
#### Class Info Scrape ####
# timetable %>% html_elements(".fkl-class") %>% .[[1]]
class_title <- timetable %>%
html_elements(".fkl-class-title") %>%
html_text2()
time <- timetable %>%
html_elements(".fkl-time") %>%
html_text2()
sublocation <- timetable %>%
html_elements(".fkl-sublocation") %>%
html_text2()
trainer <- timetable %>%
html_elements(".fkl-trainer") %>%
html_text2()
(timetable_summary <- tibble(time, class_title, sublocation, trainer))
# save:
saveRDS(timetable_summary, "data/timetable_summary.rds")
#### My Classes ####
timetable %>% html_elements(".fkl-date") %>% html_text2()
timetable %>% html_elements(".fkl-class") %>% html_text2()
# timetable %>% html_elements(".fkl-cal-td")
# timetable %>% html_elements(".fkl-cal-td") %>% .[[1]]
#timetable %>% html_elements(".fkl-class-title")
#timetable %>% html_elements(".fkl-time")
"aqua fit"
"just ride"
"wattbike"
"dance fit"
"step"
"boxing"
"kickboxing"
"boxing fdm"
"boxing padwork"
"muay thai"
"the method"
"pulse"
"dynamic pilates"
"force"
"core 45"
"yard kettlebells"
"formula 3"
"trx max"
## NotePad: ####
# x <- timetable %>% html_elements("main")
# html_elements("a") #html_elements("option") #html_elements("button")
timetable <- read_html("https://www.thirdspace.london/timetable/")
session(timetable)
# Pdf Print-Outs:
# "https://www.thirdspace.london/media/Third-Space-Class-Timetable-June-2021-1.pdf"
# <div class="fkl-cal-th">
# [1] <div class="fkl-date-title">Today</div>
# [2] <div class="fkl-date">27 Aug</div>