openzim / youtube

Create a ZIM file from a Youtube channel/username/playlist
GNU General Public License v3.0
46 stars 26 forks source link

Generate JSON files to be consumed by Vue.js UI #219

Closed dan-niles closed 3 months ago

dan-niles commented 4 months ago

This PR adds the functionality for generating JSON files to be consumed by Vue.js UI as mentioned in #212. The JSON files being generated are:

The JSON files are added "on the fly" to the ZIM as mentioned in #209. However the video files and branding files are still being copied from the build_dir.

Closes #212 Closes #220

dan-niles commented 4 months ago

@benoit74 I've included a zimdump of a ZIM file I generated using this new code here. Can you check the JSON files and let me know if everything is ok?

zimdump.zip

(I removed the video files since there is a limit of 25MB for things I can upload here)

dan-niles commented 4 months ago

Additionally, you can try running the scraper on the new testing channel created in #221 with the following command:

youtube2zim --api-key "<YOUR-API-KEY>" --type channel --id "UC8elThf5TGMpQfQc_VE917Q" --name "openZIM_testing" --output ../output
dan-niles commented 3 months ago

I added a new videoSlug property to the PlaylistPreview schema, that points to the video to be redirected to when clicking on the preview.

Edit 1 - Added joined_date, channel_name and channel_description to channel.json. Edit 2 - I found a way to get the video durations from the YouTube API. I updated the scraper to fetch the durations and include them in the JSON files.

dan-niles commented 3 months ago

Removed obsolete code and files: