Skip to content

Commit

Permalink
Merge pull request #99 from Xetera/uri-encoding
Browse files Browse the repository at this point in the history
Requoting scrape urls to fix latin1 encoding errors when downloading foreign audiobooks
  • Loading branch information
jo1gi authored Mar 4, 2024
2 parents d1db895 + a06b27e commit c9fa110
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion audiobookdl/output/metadata/id3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from mutagen.easyid3 import EasyID3, EasyID3KeyError
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, CHAP, TIT2, CTOC, CTOCFlags, WCOM, ID3NoHeaderError
from requests import utils

from typing import Sequence

Expand All @@ -25,7 +26,10 @@ def commercialurl_get(id3, key):
def commercialurl_set(id3, key, value):
id3.delall("WCOM")
for v in value:
id3.add(WCOM(url=v))
# scrape urls might contain characters in the unicode range
# for audiobooks with non-english titles
encoded_url = utils.requote_uri(v)
id3.add(WCOM(url=encoded_url))

def commercialurl_delete(id3, key):
id3.delall("WCOM")
Expand Down

0 comments on commit c9fa110

Please sign in to comment.