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

icon metadata access #429

Open
oganm opened this issue Sep 28, 2017 · 4 comments
Open

icon metadata access #429

oganm opened this issue Sep 28, 2017 · 4 comments

Comments

@oganm
Copy link

oganm commented Sep 28, 2017

it'd be nice to have a file that lists icon names and their tags for out of website querying.

@Vindexus
Copy link

+1

@mcejp
Copy link

mcejp commented Jan 12, 2019

Perhaps I could do something about this. Where is the metadata stored now?

@oganm
Copy link
Author

oganm commented Jan 15, 2019

I just scraped all the tags and descriptions for all icons. Here's the tsv file.

It won't remain up to date for long but here's the R code that did it if you want a version for yourself. Also helpful for #539

library(rvest)
library(glue)
library(dplyr)
library(magrittr)

iconNames = list.files('icons/',recursive = TRUE) %>%
    tools::file_path_sans_ext() %>% 
    stringr::str_replace('/svg/','/') 

iconNames = iconNames[!grepl('license',iconNames)]

allTags = list()
allDescriptions = list()
for(icon in iconNames[1:length(iconNames)]){
    print(icon)
    page = read_html(glue('https://game-icons.net/{icon}.html'))
    tags =page %>% 
        html_nodes('a[rel="tag"]') %>% 
        html_text()
    allTags[[icon]] = tags
    
    description = page %>% html_node('.description') %>% html_text(trim=TRUE)
    allDescriptions[[icon]] = description
}

allTags %>%
    sapply(function(x){paste(x,collapse = '|')}) ->
    mergedTags

data.frame(name = names(mergedTags),
           tags = mergedTags,stringsAsFactors = FALSE,
           description = allDescriptions %>% unlist) ->
    tagFrame

readr::write_tsv(tagFrame,'iconTags.txt')

@ThaumRystra
Copy link

Here is a cleaned up JSON file of the metadata organm linked above: game-icons-metadata.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants