summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wikiarticle.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/wikiarticle.go b/src/wikiarticle.go
index 984eac3..864f6c4 100644
--- a/src/wikiarticle.go
+++ b/src/wikiarticle.go
@@ -28,6 +28,7 @@ type wikiArticleEntry struct {
// fetchWikiArticlesData queries the custom wiki server for all entries
// that have a wiki_article and updates the imdb table with extracted fields.
func (a *App) fetchWikiArticlesData() error {
+ /*
rows, err := a.DB.Query(`
SELECT id, imdb_id, wiki_article FROM imdb
WHERE wiki_article IS NOT NULL
@@ -35,6 +36,13 @@ func (a *App) fetchWikiArticlesData() error {
AND (synopsis IS NULL OR description IS NULL OR year IS NULL
OR poster_url IS NULL OR license IS NULL OR license_url IS NULL OR num_accolades IS NULL)
`)
+ */
+ rows, err := a.DB.Query(`
+ SELECT id, imdb_id, wiki_article FROM imdb
+ WHERE wiki_article IS NOT NULL
+ AND (synopsis IS NULL OR description IS NULL OR year IS NULL
+ OR poster_url IS NULL OR license IS NULL OR license_url IS NULL OR num_accolades IS NULL)
+ `)
if err != nil {
return fmt.Errorf("query wiki articles: %w", err)
}
@@ -149,10 +157,9 @@ func (a *App) fetchWikiArticlesData() error {
// queryWikiArticle fetches and parses a single wiki article from the custom server.
func (a *App) queryWikiArticle(name string) (wikiArticleEntry, int, error) {
- reqURL := a.Config.WikiServer + "?" + url.Values{
- "username": {a.Config.WikiUsername},
- "name": {name},
- }.Encode()
+ // Build URL manually — name is already URL-encoded in the DB
+ reqURL := fmt.Sprintf("%s?username=%s&name=%s",
+ a.Config.WikiServer, url.QueryEscape(a.Config.WikiUsername), name)
var resp *http.Response
var err error