miyouzi / aniGamerPlus

巴哈姆特動畫瘋自動下載工具,支援命令行
GNU General Public License v3.0
690 stars 95 forks source link

Error: 'latin-1' codec can't encode character '\u20ac' in position 43: ordinal not in range(256) #293

Open OhMy-Git opened 1 day ago

OhMy-Git commented 1 day ago

問題描述

用的是 Windows 24.6 版 exe

抓取影片信息時發生未知錯誤: 'latin-1' codec can't encode character '\u20ac' in position 43: ordinal not in range(256) 2024-11-12 09:34:45 抓取異常: sn=40167

異常詳情: File "http\client.py", line 1225, in putheader UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 43: ordinal not in range(256)

錯誤截圖

PIC006

config.json 配置

{ "bangumi_dir": "", "temp_dir": "", "classify_bangumi": true, "classify_season": false, "check_frequency": 5, "download_cd": 60, "parse_sn_cd": 5, "download_resolution": "1080", "lock_resolution": false, "only_use_vip": false, "default_download_mode": "latest", "use_copyfile_method": false, "multi-thread": 1, "multi_upload": 3, "segment_download_mode": true, "multi_downloading_segment": 2, "segment_max_retry": 8, "add_bangumi_name_to_video_filename": true, "add_resolution_to_video_filename": true, "customized_video_filename_prefix": "Anim-", "customized_bangumi_name_suffix": "", "customized_video_filename_suffix": "", "video_filename_extension": "mp4", "zerofill": 1, "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36", "use_proxy": false, "proxy": "http://user:passwd@example.com:1000", "no_proxy_akamai": false, "upload_to_server": false, "ftp": { "server": "", "port": "", "user": "", "pwd": "", "tls": true, "cwd": "", "show_error_detail": false, "max_retry_num": 15 }, "user_command": "shutdown -s -t 60", "coolq_notify": false, "coolq_settings": { "msg_argument_name": "message", "message_suffix": "追加的資訊", "query": [ "http://127.0.0.1:5700/send_group_msg?access_token=abc&group_id=12345678", "http://127.0.0.1:5700/send_group_msg?access_token=abc&group_id=87654321" ] }, "telebot_notify": false, "telebot_token": "", "telebot_use_chat_id": false, "telebot_chat_id": "", "discord_notify": false, "discord_token": "", "plex_refresh": false, "plex_url": "", "plex_token": "", "plex_section": "", "plex_naming": false, "faststart_movflags": false, "audio_language": false, "use_mobile_api": false, "danmu": false, "danmu_ban_words": [], "check_latest_version": true, "read_sn_list_when_checking_update": true, "read_config_when_checking_update": true, "ads_time": 25, "mobile_ads_time": 25, "use_dashboard": true, "dashboard": { "host": "127.0.0.1", "port": 5000, "SSL": false, "BasicAuth": false, "username": "admin", "password": "admin" }, "save_logs": true, "quantity_of_logs": 7, "config_version": 17.2, "database_version": 2.0 }

sn_list.txt 配置

40167

log 檔案 2024-11-12 09:34:40 檢查更新 檢查更新成功 2024-11-12 09:34:40 自動模式啓動aniGamerPlus 當前aniGamerPlus版本: v24.6 2024-11-12 09:34:40 工作目錄: C:\Temp\aniGamerPlus 2024-11-12 09:34:44 Web控制面板已啓動 訪問地址: http://127.0.0.1:5000 2024-11-12 09:34:44 開始更新 2024-11-12 09:34:44 檔案讀取 C:\Temp\aniGamerPlus\cookie.txt 編碼為 Windows-1252 將轉碼為 UTF-8 2024-11-12 09:34:44 檔案讀取 C:\Temp\aniGamerPlus\cookie.txt 轉碼成功 2024-11-12 09:34:44 讀取cookie 發現cookie檔案 2024-11-12 09:34:44 讀取cookie 已讀取cookie 2024-11-12 09:34:44 解析模式: sn=40167 Web解析 2024-11-12 09:34:44 收到新cookie: sn=40167 2024-11-12 09:34:44 用戶cookie刷新 : sn=40167
2024-11-12 09:34:45 抓取失敗: sn=40167 抓取影片信息時發生未知錯誤: 'latin-1' codec can't encode character '\u20ac' in position 43: ordinal not in range(256) 2024-11-12 09:34:45 抓取異常: sn=40167 異常詳情: Traceback (most recent call last): File "aniGamerPlus.py", line 55, in build_anime File "Anime.py", line 72, in init File "Anime.py", line 137, in __get_src File "Anime.py", line 359, in request File "Anime.py", line 287, in request File "requests\sessions.py", line 602, in get File "requests\sessions.py", line 589, in request File "requests\sessions.py", line 703, in send File "requests\adapters.py", line 486, in send File "urllib3\connectionpool.py", line 789, in urlopen File "urllib3\connectionpool.py", line 495, in _make_request File "urllib3\connection.py", line 440, in request File "urllib3\connection.py", line 354, in putheader File "http\client.py", line 1225, in putheader UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 43: ordinal not in range(256)

2024-11-12 09:34:45 SN 解析冷卻 5 秒 2024-11-12 09:34:50 更新狀態: sn=40167 檢查更新失敗, 跳過等待下次檢查 2024-11-12 09:34:50 更新資訊 本次更新添加了 0 個新任務, 目前列隊中共有 0 個任務 2024-11-12 09:34:50 更新终了

miyouzi commented 1 day ago

cookie.txt 不要包含特殊字符,似乎你的cookie中存在字符

OhMy-Git commented 18 hours ago

Ctrl+f 的確發現該字符 €... 但這個是瀏覽器產生後複製貼上的,不知如何去掉它...? 直接在 cookie.txt 檔案裡 delete 該字元後存檔嗎? 或是一直重刷瀏覽器 等其產生新的不含該字元的 cookie 呢? 或是可以在 client.py encode 時過濾呢? 如果問得太小白請見諒。謝謝您開發這好用的工具。