Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip download of speaker image if url is "-" #228

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
)
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
Loading