Created
February 26, 2023 17:20
-
-
Save jthomasmock/10e217dab119bccb7df8d6d0aa483dab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r write-tags} | |
#| echo: false | |
library(rvest) | |
library(xml2) | |
raw_html <- read_html(here::here("_site/index.html")) | |
length_tags <- raw_html |> | |
html_nodes("#quarto-margin-sidebar > div > div") |> | |
length() | |
all_tags <- sapply(seq_len(length_tags), function(x){ | |
html_nodes(raw_html, xpath = glue::glue('//*[@id="quarto-margin-sidebar"]/div/div[{x}]/text()')) |> | |
html_text(trim = TRUE) | |
}) | |
all_tags[all_tags != "All"] |> | |
write_lines(here::here("_data/unique_categories.txt")) | |
``` | |
# Gist URL https://gist.github.com/10e217dab119bccb7df8d6d0aa483dab | |
# Code image at: ![](https://i.imgur.com/jAQJlNS.png) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment