wechat-media-writer 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechat-media-writer",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "微信公众号书评、影评文章自动生成与发布 - Skill",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -9,6 +9,7 @@ import os
9
9
  import re
10
10
  import ssl
11
11
  import urllib.request
12
+ import urllib.parse
12
13
 
13
14
 
14
15
  def fetch_book_cover_google(book_title, author=""):
@@ -21,7 +22,7 @@ def fetch_book_cover_google(book_title, author=""):
21
22
  if author:
22
23
  query += f"+inauthor:{author}"
23
24
 
24
- url = f"https://www.googleapis.com/books/v1/volumes?q={query}&maxResults=1"
25
+ url = f"https://www.googleapis.com/books/v1/volumes?q={urllib.parse.quote(query)}&maxResults=1"
25
26
  req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
26
27
 
27
28
  try:
@@ -71,7 +72,7 @@ def fetch_book_cover_douban(book_title, author=""):
71
72
  ctx.verify_mode = ssl.CERT_NONE
72
73
 
73
74
  query = f"{book_title} {author}".strip()
74
- url = f"https://search.douban.com/book/subject_search?search_text={query}"
75
+ url = f"https://search.douban.com/book/subject_search?search_text={urllib.parse.quote(query)}"
75
76
  req = urllib.request.Request(
76
77
  url,
77
78
  headers={