JBGruber / rwhatsapp

An R package for working with WhatsApp data 💬
94 stars 19 forks source link

issue report #20

Closed ykocaturk closed 3 years ago

ykocaturk commented 3 years ago

Hi, I encountered an error while working. It was fixed when I did - instead of + in the emoji url. actual https://abs.twimg.com/emoji/v2/72x72/1f44d+1f3fb.png new https://abs.twimg.com/emoji/v2/72x72/1f44d-1f3fb.png

JBGruber commented 3 years ago

Thanks for reporting! I changed the vignette now. So combined emojis are actually ignored.

If you want to try to keep them, you could try the following, which should work for most common emojis:

library(tidyverse)
emoji_data <- rwhatsapp::emojis %>% # data built into package
  mutate(hex_runes1 = gsub("\\sU\\+", "-", hex_runes)) %>% # replace whitespace & U+ with - to creat urls
  mutate(emoji_url = paste0("https://abs.twimg.com/emoji/v2/72x72/", 
                            tolower(hex_runes1), ".png"))
ykocaturk commented 3 years ago

Hi,I used the sent code with little change.  gsub("\sU\+|\s", "-", hex_runes))

when i run graphic codes i got http 404 error. As a result of researching on the internet, I checked the url with the following code

valid_url <- function(url_in,t=2){  con <- url(url_in)  check <- suppressWarnings(try(open.connection(con,open="rt",timeout=t),silent=T)[1])  suppressWarnings(try(close.connection(con),silent=T))  ifelse(is.null(check),TRUE,FALSE)} y2 <- sapply(emoji_data$emoji_url,valid_url) the results were extremely surprising.

 table(y2)y2FALSE  TRUE  4013    72  1 Kasım 2020 Pazar 21:17:27 GMT+3 tarihinde, Johannes Gruber notifications@github.comşunu yazdı:

Thanks for reporting! I changed the vignette now. So combined emojis are actually ignored.

If you want to try to keep them, you could try the following, which should work for most common emojis: library(tidyverse) emoji_data <- rwhatsapp::emojis %>% # data built into package mutate(hex_runes1 = gsub("\sU\+", "-", hex_runes)) %>% # ignore combined emojis mutate(emoji_url = paste0("https://abs.twimg.com/emoji/v2/72x72/", tolower(hex_runes1), ".png"))

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

JBGruber commented 3 years ago

If you share your data with me, I can have a look. Otherwise, please refer to the new version in the demo: https://github.com/JBGruber/rwhatsapp#demo

ykocaturk commented 3 years ago

Hi, Everything was fixed when I used your new code and gave up the multiple emoji url.

Thank you 3 Kasım 2020 Salı 22:23:20 GMT+3 tarihinde, Johannes Gruber notifications@github.comşunu yazdı:

If you share your data with me, I can have a look. Otherwise, please refer to the new version in the demo: https://github.com/JBGruber/rwhatsapp#demo

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

JBGruber commented 3 years ago

I'm afraid giving up the multi-character emojis is the only bullet-proof method for now.