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

Use proper ZIM metadata key for Scraper and Tags #370

Merged
merged 1 commit into from
Oct 21, 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
2 changes: 1 addition & 1 deletion .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
env:
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
OPTIMIZATION_CACHE_URL: ${{ secrets.OPTIMIZATION_CACHE_URL }}
run: docker run -v $PWD/output:/output youtube2zim youtube2zim --api-key "$YOUTUBE_API_KEY" --optimization-cache "$OPTIMIZATION_CACHE_URL" --type channel --id "UC8elThf5TGMpQfQc_VE917Q" --name "openZIM_testing" --zim-file "openZIM_testing.zim"
run: docker run -v $PWD/output:/output youtube2zim youtube2zim --api-key "$YOUTUBE_API_KEY" --optimization-cache "$OPTIMIZATION_CACHE_URL" --type channel --id "UC8elThf5TGMpQfQc_VE917Q" --name "tests_en_openzim-testing" --zim-file "openZIM_testing.zim" --tags "tEsTing,x-mark:yes"

- name: Run integration test suite
run: docker run -v $PWD/scraper/tests-integration/integration.py:/src/scraper/tests-integration/integration.py -v $PWD/output:/output youtube2zim bash -c "pip install pytest; pytest -v /src/scraper/tests-integration/integration.py"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Filter-out non-public videos and properly cleanup unsuccessful videos (#362)
- Use proper ZIM metadata key for `Scraper` and `Tags` (#369)

## [3.2.0] - 2024-10-11

Expand Down
4 changes: 2 additions & 2 deletions scraper/src/youtube2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ def run(self):
LongDescription=self.long_description,
Creator=self.creator,
Publisher=self.publisher,
tags=";".join(self.tags) if self.tags else "",
scraper=SCRAPER,
Tags=";".join(self.tags) if self.tags else "",
Scraper=SCRAPER,
Date=datetime.date.today(),
Illustration_48x48_at_1=illustration_data,
)
Expand Down
14 changes: 8 additions & 6 deletions scraper/tests-integration/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ def test_zim_metadata():

zim_fh = Archive(ZIM_FILE_PATH)

assert "youtube2zim " in zim_fh.get_text_metadata("scraper")
assert "openZIM_testing" in zim_fh.get_text_metadata("Title")
assert "-" in zim_fh.get_text_metadata("Description")
assert "en" in zim_fh.get_text_metadata("Language")
assert "openZIM" in zim_fh.get_text_metadata("Publisher")
assert "openZIM_testing" in zim_fh.get_text_metadata("Creator")
assert "youtube2zim " in zim_fh.get_text_metadata("Scraper")
assert zim_fh.get_text_metadata("Tags") == "tEsTing;x-mark:yes;_videos:yes"
assert zim_fh.get_text_metadata("Title") == "openZIM_testing"
assert zim_fh.get_text_metadata("Description") == "-"
assert zim_fh.get_text_metadata("Language") == "eng"
assert zim_fh.get_text_metadata("Name") == "tests_en_openzim-testing"
assert zim_fh.get_text_metadata("Publisher") == "openZIM"
assert zim_fh.get_text_metadata("Creator") == "Youtube Channel “openZIM_testing”"

assert zim_fh.get_item("profile.jpg").mimetype == "image/jpeg"
assert zim_fh.get_item("favicon.png").mimetype == "image/png"
Expand Down