diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-08-16 21:13:24 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-08-16 21:13:24 +0200 |
commit | 5cc735b22570f1667d62958e59ce4910b529f5af (patch) | |
tree | 75128a8926a48a612bc892d266032bd7afd9c2cf /src/NetUtils.cpp | |
parent | de4825e548b990493b372237cbef9a790bf114c4 (diff) |
Add MyAnimeList (wip)
Diffstat (limited to 'src/NetUtils.cpp')
-rw-r--r-- | src/NetUtils.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/NetUtils.cpp b/src/NetUtils.cpp index 28256cb..0f957d5 100644 --- a/src/NetUtils.cpp +++ b/src/NetUtils.cpp @@ -34,17 +34,6 @@ namespace QuickMedia { std::string unescaped_str; }; - static bool to_num(const char *str, size_t size, int &num) { - num = 0; - for(size_t i = 0; i < size; ++i) { - const char num_c = str[i] - '0'; - if(num_c < 0 || num_c > 9) - return false; - num = (num * 10) + num_c; - } - return true; - } - static void html_unescape_sequence_numbers(std::string &str) { size_t index = 0; while(true) { @@ -69,10 +58,13 @@ namespace QuickMedia { void html_unescape_sequences(std::string &str) { html_unescape_sequence_numbers(str); - const std::array<HtmlUnescapeSequence, 4> unescape_sequences = { + // TODO: Use string find and find & and ; instead of string_replace_all + const std::array<HtmlUnescapeSequence, 6> unescape_sequences = { HtmlUnescapeSequence { """, "\"" }, HtmlUnescapeSequence { "<", "<" }, HtmlUnescapeSequence { ">", ">" }, + HtmlUnescapeSequence { "—", "—" }, + HtmlUnescapeSequence { " ", " " }, HtmlUnescapeSequence { "&", "&" } // This should be last, to not accidentally replace a new sequence caused by replacing this }; |