{"id":14068649,"url":"https://github.com/alastairrushworth/htmldf","last_synced_at":"2026-03-04T17:32:41.917Z","repository":{"id":56934227,"uuid":"244134774","full_name":"alastairrushworth/htmldf","owner":"alastairrushworth","description":"🖥  ✂️  📁  Simple scraping and tidy webpage summaries","archived":false,"fork":false,"pushed_at":"2022-08-07T06:33:41.000Z","size":29112,"stargazers_count":82,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T12:47:08.939Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alastairrushworth.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-01T11:13:45.000Z","updated_at":"2025-03-22T10:49:51.000Z","dependencies_parsed_at":"2022-08-21T00:40:29.624Z","dependency_job_id":null,"html_url":"https://github.com/alastairrushworth/htmldf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alastairrushworth/htmldf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alastairrushworth%2Fhtmldf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alastairrushworth%2Fhtmldf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alastairrushworth%2Fhtmldf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alastairrushworth%2Fhtmldf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alastairrushworth","download_url":"https://codeload.github.com/alastairrushworth/htmldf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alastairrushworth%2Fhtmldf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30087376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:06:19.540Z","updated_at":"2026-03-04T17:32:41.886Z","avatar_url":"https://github.com/alastairrushworth.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n# htmldf \u003cimg src=\"man/figures/hex.png\" align=\"right\" width=\"150\" /\u003e\n![build](https://github.com/alastairrushworth/htmldf/workflows/R-CMD-check/badge.svg)\n[![codecov](https://codecov.io/gh/alastairrushworth/htmldf/branch/master/graph/badge.svg)](https://app.codecov.io/gh/alastairrushworth/htmldf)\n[![CRAN status](https://www.r-pkg.org/badges/version/htmldf)](https://CRAN.R-project.org/package=htmldf)\n[![](https://cranlogs.r-pkg.org/badges/htmldf)](https://CRAN.R-project.org/package=htmldf)\n[![cran checks](https://cranchecks.info/badges/summary/htmldf)](https://cran.r-project.org/web/checks/check_results_htmldf.html)  \n\nOverview\n---\n\nThe package `htmldf` contains a single function `html_df()` which accepts a vector of urls as an input and from each will attempt to download each page, extract and parse the html.  The result is returned as a `tibble` where each row corresponds to a document, and the columns contain page attributes and metadata extracted from the html, including:\n\n+ page title\n+ inferred language (uses Google's compact language detector)\n+ RSS feeds\n+ tables coerced to tibbles, where possible\n+ hyperlinks\n+ image links\n+ social media profiles\n+ the inferred programming language of any text with code tags\n+ page size, generator and server\n+ page accessed date\n+ page published or last updated dates\n+ HTTP status code\n+ full page source html\n\nInstallation\n---  \n\nTo install the CRAN version of the package:\n\n```{r, eval=FALSE}\ninstall.packages('htmldf')\n```\n\nTo install the development version of the package:\n\n```{r, eval=FALSE}\nremotes::install_github('alastairrushworth/htmldf')\n```\n\nUsage\n---  \n\nFirst define a vector of URLs you want to gather information from.  The function `html_df()` returns a `tibble` where each row corresponds to a webpage, and each column corresponds to an attribute of that webpage:\n```{r, message=FALSE, warning=FALSE}\nlibrary(htmldf)\nlibrary(dplyr)\n\n# An example vector of URLs to fetch data for\nurlx \u003c- c(\"https://alastairrushworth.github.io/Visualising-Tour-de-France-data-in-R/\",\n          \"https://medium.com/dair-ai/pytorch-1-2-introduction-guide-f6fa9bb7597c\",\n          \"https://www.tensorflow.org/tutorials/images/cnn\", \n          \"https://www.analyticsvidhya.com/blog/2019/09/introduction-to-pytorch-from-scratch/\")\n\n# use html_df() to gather data\nz \u003c- html_df(urlx, show_progress = FALSE)\n\n# have a quick look at the first page\nglimpse(z[1, ])\n```\n\nTo see the page titles, look at the `titles` column.  \n```{r}\nz %\u003e% select(title, url2)\n```\n\n\nWhere there are tables embedded on a page in the `\u003ctable\u003e` tag, these will be gathered into the list column `tables`.  `html_df` will attempt to coerce each table to `tibble` - where that isn't possible, the raw html is returned instead.\n\n```{r}\nz$tables\n```\n\n`html_df()` does its best to find RSS feeds embedded in the page:\n```{r}\nz$rss\n```\n\n`html_df()` will try to parse out any social profiles embedded or mentioned on the page.  Currently, this includes profiles for the sites\n\n`bitbucket`, `dev.to`, `discord`, `facebook`, `github`, `gitlab`, `instagram`, `kakao`, `keybase`, `linkedin`, `mastodon`, `medium`, `orcid`, `patreon`, `researchgate`, `stackoverflow`, `reddit`, `telegram`, `twitter`, `youtube`\n\n\n```{r}\nz$social\n```\n\nCode language is inferred from `\u003ccode\u003e` chunks using a preditive model.  The `code_lang` column contains a numeric score where values near 1 indicate mostly R code, values near -1 indicate mostly Python code:\n```{r}\nz %\u003e% select(code_lang, url2)\n```\n\nPublication dates\n\n```{r}\nz %\u003e% select(published, url2)\n```\n\n\nComments? Suggestions? Issues?\n---  \n\nAny feedback is welcome! Feel free to write a github issue or send me a message on [twitter](https://twitter.com/rushworth_a).\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falastairrushworth%2Fhtmldf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falastairrushworth%2Fhtmldf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falastairrushworth%2Fhtmldf/lists"}