diff --git a/atom/atom.go b/atom/atom.go index 42ad241..e226f1f 100644 --- a/atom/atom.go +++ b/atom/atom.go @@ -72,5 +72,20 @@ func stitchFields(info []string, connectors []string, indices []int8) string { output.WriteString(info[indices[i]]) } } - return output.String() + return interpretUnicode(output.String()) +} + +func interpretUnicode(s string) string { + // match \uXXXX patterns + r := regexp.MustCompile(`\\u([0-9a-fA-F]{4})`) + result := r.ReplaceAllStringFunc(s, func(match string) string { + // extract the hex value + hexStr := match[2:] // skip the \u part + code, err := strconv.ParseInt(hexStr, 16, 32) + if err != nil { + return match // if parsing fails, return original + } + return string(rune(code)) + }) + return result } diff --git a/examples/feed-cached.php b/examples/feed-cached.php new file mode 100644 index 0000000..1b8eb02 --- /dev/null +++ b/examples/feed-cached.php @@ -0,0 +1,13 @@ + " . escapeshellarg($tempFile) . " 2>&1 && mv " . escapeshellarg($tempFile) . " " . escapeshellarg($cacheFile) . " &"); +?> \ No newline at end of file diff --git a/examples/input_xmls/videocardz-scrape.xml b/examples/input_xmls/videocardz-scrape.xml new file mode 100644 index 0000000..25f889d --- /dev/null +++ b/examples/input_xmls/videocardz-scrape.xml @@ -0,0 +1,26 @@ + + http://PLACEHOLDER:8191/v1 + .*?(.*?)<\/title>.*?<link>(.*?)<\/link>.*?<description><!\[CDATA\[ (.*?)<br\/>]]></regex> + <loadSeconds>0</loadSeconds> + <maxFeedItems>10</maxFeedItems> + <feed> + <title> + <parent>VideoCardz</parent> + <captureGroupIndex>1</captureGroupIndex> + + https://videocardz.com/rss-feed + 2 + + + Official RSS Feed from VideoCardz.com translated to Atom. + 3 + + + VideoCardz.com + + + maciej+rssfeed@videocardz.com + + +