Сниппет для Ситилаб

У Ситилаба дебильный API, XML контент завернут в base64(bzip2(content)), так что вот сниппет для его распаковывания. Можно скопировать в https://play.golang.org/p/LrySJFKkVqH и прогнать его там:

package main

import (
    "bytes"
    "compress/bzip2"
    "encoding/base64"
    "fmt"
    "io/ioutil"
    "log"

    "golang.org/x/text/encoding/charmap"
)

const c = "QlpoOTFBWSZTWbKFEAQAEUYfh9Bn/+e/t0mAv+/f4HjX6QB////t4AfffW5997D773x94AAAA++4aADJVPyaSek9QGQDQ8JBpggGTQBoDJkMgBiAAQEM1VJkYJgjRpgCYAEYTRkwCYATAACMQFTyelQBo9pTQ0B6hoyDTIeoZAAAGg0AAACTSqU9IAMjQaGgAMQAZDQAAGTRkAAACaqU0JoKeAp4p6mjQA0ZDTQZAMgAMyQAAAAikI01NEp+qfggptDUAYTQMJoAAANPUGaTEHqenqJ9n5/sfvE5zmRMnOZHi5IqIKj24FR+BUYVmKjCUsCYExCYoTMJj3BVEIFUQ93kHAOPLNfLTaMPKQxQKTAogeIUnm0VeqA4aDBBtNgiB5+BUELz8AWuFkRkS7WxYoqiCUSmKBnkJICcQqOHAl+CIzMjaUQ4ZRApUNQNOkTdAsoAgB3d4iIgTnOc5gAACoMzJvJITZBwZv3cYzVqqrkNVVwORg+jg92lrftkkTigEIAsxEQG1ie97yhZC9EasTWMRzWKjgglLKQ2OLqzpa7C60rUicUlfhuqjWBUcVRhUa9YZCdWSE6UkIkkJZAgFw4VVVVVXt0oiIiIiIiIieGlETBSlttttttttKWlLSlpS0paUtttW221aW0IF88kJxJITySQmGSE8ckJpEyE0xOtUloE6Xy8GeqoPOQTYel5QH6DbYsGL1ibLzXWyACSDQJBMNlyS9mSX0cCRoaGhIhSTAEAVDVsCmrYzMiQ0RVEBkIQETRzgKAlERlaCIyVCIyiUUeJPCTRlZrsGZHCO7QtHSEVVZzMnV5vR0nJSVWcmQjcTlEQ0Ks0VkZoIrxCMCQCwEUIqsrQZEs4pFIosKpKilW+tKzrfSspEESt2w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u/8XckU4UJCyhRAEA=="

func main() {
    data, err := base64.StdEncoding.DecodeString(c)
    if err != nil {
        log.Fatal(err)
    }

    rd := bzip2.NewReader(bytes.NewReader(data))
    wr := charmap.Windows1251.NewDecoder().Reader(rd)

    buf, err := ioutil.ReadAll(wr)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(string(buf))
}

Last updated