Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scraper la presse #17

Merged
merged 4 commits into from
Mar 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed keyUrl for the key making
ClementCadieux committed Mar 30, 2023
commit dfcdc4f5fe26aa589628e49b51a19f51dc5f8f63
13 changes: 11 additions & 2 deletions pipelines/extractors/e_radar+.R
Original file line number Diff line number Diff line change
@@ -236,8 +236,12 @@ harvest_headline <- function(r, m) {

clessnverse::logit(scriptname, paste("pushing headline", url, "to hub"), logger)

keyUrl <- url
if(substr(keyUrl, nchar(keyUrl) - 1 + 1, nchar(keyUrl)) == '/'){
keyUrl <- substr(keyUrl, 1, nchar(keyUrl) - 1)
}
#key = paste(digest::digest(url), gsub(" |-|:", "", Sys.time()), sep="_")
key <- gsub(" |-|:|/|\\.", "_", paste(stringr::str_match(url, "[^/]+$"), Sys.time(), sep="_"))
key <- gsub(" |-|:|/|\\.", "_", paste(stringr::str_match(keyUrl, "[^/]+$"), Sys.time(), sep="_"))

hub_response <- clessnverse::commit_lake_item(
data = list(
@@ -304,7 +308,12 @@ main <- function() {
clessnverse::logit(scriptname, paste("pushing frontpage", url, "to hub"), logger)

#key = paste(digest::digest(url), gsub(" |-|:", "", Sys.time()), sep="_")
key <- gsub(" |-|:|/|\\.", "_", paste(stringr::str_match(url, "[^/]+$"), Sys.time(), sep="_"))
keyUrl <- url
if(substr(keyUrl, nchar(keyUrl) - 1 + 1, nchar(keyUrl)) == '/'){
keyUrl <- substr(keyUrl, 1, nchar(keyUrl) - 1)
}

key <- gsub(" |-|:|/|\\.", "_", paste(stringr::str_match(keyUrl, "[^/]+$"), Sys.time(), sep="_"))
if (opt$refresh_data) mode <- "refresh" else mode <- "newonly"

hub_response <- clessnverse::commit_lake_item(