Skip to content

Commit

Permalink
Fix windows encoding issues (#13)
Browse files Browse the repository at this point in the history
* fix article text encoding

Co-Authored-By: Ak500 <[email protected]>

* temp fix windows long path issue

pushed one directory back to not exceed the windows path limit

Co-Authored-By: Ak500 <[email protected]>

---------

Co-authored-by: Ak500 <[email protected]>
  • Loading branch information
swargaraj and TheLinuxMentor authored Oct 14, 2024
1 parent 5b66a22 commit 65b3820
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion utils/process_articles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def download_article(udemy, article, download_folder_path, title_of_output_artic
article_filename = f"{title_of_output_article}.html"
article_response = udemy.request(ARTICLE_URL.format(article_id=article['id'])).json()

with open(os.path.join(os.path.dirname(download_folder_path), article_filename), 'w') as file:
with open(os.path.join(os.path.dirname(download_folder_path), article_filename), 'w', encoding='utf-8', errors='replace') as file:
file.write(article_response['body'])

progress.console.log(f"[green]Downloaded {title_of_output_article}[/green] ✓")
Expand Down
2 changes: 1 addition & 1 deletion utils/process_m3u8.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def merge_segments_into_mp4(m3u8_file_path, download_folder_path, output_file_na
nm3u8dl_command = (
f"n_m3u8dl-re \"{m3u8_file_path}\" --save-dir \"{output_path}\" "
f"--save-name \"{output_file_name}\" --auto-select --concurrent-download "
f"--del-after-done --no-log --tmp-dir \"{download_folder_path}\" --log-level ERROR"
f"--del-after-done --no-log --tmp-dir \"{output_path}\" --log-level ERROR"
)

pattern = re.compile(r'(\d+\.\d+%)')
Expand Down
2 changes: 1 addition & 1 deletion utils/process_mpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def process_mpd(mpd_file_path, download_folder_path, output_file_name, length, k
nm3u8dl_command = (
f"n_m3u8dl-re \"{mpd_file_path}\" --save-dir \"{download_folder_path}\" "
f"--save-name \"{output_file_name}.mp4\" --auto-select --concurrent-download "
f"--key {key} --del-after-done --no-log --tmp-dir \"{download_folder_path}\" "
f"--key {key} --del-after-done --no-log --tmp-dir \"{output_path}\" "
f"--log-level ERROR"
)

Expand Down

0 comments on commit 65b3820

Please sign in to comment.