修复标题含有空格导致URL出错的BUG

使用urllib库进行转义,把空格转义为%20
This commit is contained in:
呆瓜云 2023-07-31 16:34:11 +08:00
parent 8cb3735772
commit 3ff39183a9
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import json
import time import time
import datetime import datetime
import shutil import shutil
import urllib
import requests import requests
import argparse import argparse
from github import Github from github import Github
@ -99,7 +100,7 @@ class GMEEK():
self.blogBase["postListJson"][postNum]["label"]=issue.labels[0].name self.blogBase["postListJson"][postNum]["label"]=issue.labels[0].name
self.blogBase["postListJson"][postNum]["labelColor"]=self.labelColorDict[issue.labels[0].name] self.blogBase["postListJson"][postNum]["labelColor"]=self.labelColorDict[issue.labels[0].name]
self.blogBase["postListJson"][postNum]["postTitle"]=issue.title self.blogBase["postListJson"][postNum]["postTitle"]=issue.title
self.blogBase["postListJson"][postNum]["postUrl"]=self.post_folder+'{}.html'.format(Pinyin().get_pinyin(issue.title)) self.blogBase["postListJson"][postNum]["postUrl"]=urllib.parse.quote(self.post_folder+'{}.html'.format(Pinyin().get_pinyin(issue.title)))
self.blogBase["postListJson"][postNum]["postSourceUrl"]="https://github.com/"+options.repo_name+"/issues/"+str(issue.number) self.blogBase["postListJson"][postNum]["postSourceUrl"]="https://github.com/"+options.repo_name+"/issues/"+str(issue.number)
self.blogBase["postListJson"][postNum]["commentNum"]=issue.get_comments().totalCount self.blogBase["postListJson"][postNum]["commentNum"]=issue.get_comments().totalCount