json uit html -> html.Unescape
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"html"
|
||||||
|
|
||||||
e "codeberg.org/pebbe/errors"
|
e "codeberg.org/pebbe/errors"
|
||||||
|
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
@@ -165,7 +167,7 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
|||||||
if i2 < i1 {
|
if i2 < i1 {
|
||||||
ok = false
|
ok = false
|
||||||
} else {
|
} else {
|
||||||
s = s[i1:i2]
|
s = html.UnescapeString(s[i1:i2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
|||||||
if i2 < i1 {
|
if i2 < i1 {
|
||||||
ok = false
|
ok = false
|
||||||
} else {
|
} else {
|
||||||
s = s[i1:i2]
|
s = html.UnescapeString(s[i1:i2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@@ -183,7 +184,7 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
|||||||
ok = false
|
ok = false
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
s2 = s[i1:i2]
|
s2 = html.UnescapeString(s[i1:i2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = json.Unmarshal([]byte(s2), &doc); err != nil {
|
if err = json.Unmarshal([]byte(s2), &doc); err != nil {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -162,7 +163,7 @@ func doArticle(filename string, url string, title string, timestamp time.Time, n
|
|||||||
if i2 < i1 {
|
if i2 < i1 {
|
||||||
ok = false
|
ok = false
|
||||||
} else {
|
} else {
|
||||||
s = s[i1:i2]
|
s = html.UnescapeString(s[i1:i2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ func doArticle(filename string, url string, title string, tags []string, cats []
|
|||||||
if i2 < i1 {
|
if i2 < i1 {
|
||||||
ok = false
|
ok = false
|
||||||
} else {
|
} else {
|
||||||
s = s[i1:i2]
|
s = html.UnescapeString([i1:i2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user