Skip to content

Commit

Permalink
skip download of speaker image if url is "-"
Browse files Browse the repository at this point in the history
  • Loading branch information
elfkuzco committed Oct 15, 2024
1 parent 19bd9c0 commit 88c69df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Restore functionality to resist temporary bad TED responses when parsing video pages (#209)
- Retry video data extraction if `videoData` is missing from page data (#226)
- Skip download of speaker image if URL is "-" (#224)

## [3.0.2] - 2024-06-24

Expand Down
8 changes: 7 additions & 1 deletion src/ted2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,15 @@ def download_speaker_image(
)
if not downloaded_from_cache:
try:
# download an image of the speaker
# Before downloading a speaker image, check if the URL exists.
# Sometimes, the URL from TED is "-" which is invalid.
if not video_speaker:
logger.debug("Speaker doesn't have an image")
elif video_speaker == "-":
logger.error(

Check warning on line 1041 in src/ted2zim/scraper.py

View check run for this annotation

Codecov / codecov/patch

src/ted2zim/scraper.py#L1041

Added line #L1041 was not covered by tests
f"Invalid speaker image URL {video_speaker!r} for "
f"{video_title}"
)
else:
logger.debug(f"Downloading Speaker image for {video_title}")
self.download_jpeg_image_and_convert(
Expand Down

0 comments on commit 88c69df

Please sign in to comment.