Romern / syncMyMoodle

Synchronization client for RWTH Moodle
GNU General Public License v3.0
73 stars 18 forks source link

Download youtube playlists #40

Closed autoantwort closed 3 years ago

autoantwort commented 3 years ago

I don't know if that is possible, but it would be cool if syncMyMoodle downloads the videos of a playlist and not just the playlist file. Eg in the DIS2 course they only put a link to the youtube playlist in the Moodle room.

Romern commented 3 years ago

Could you check if it works now? https://github.com/Romern/syncMyMoodle/commit/9e6691512965fea537c90d50a2a68be863cc5172

autoantwort commented 3 years ago

Unfortunately not. It still only downloads the playlist file:

Downloading files...
Downloading /Users/leanderSchulten/RWTH/Moodle/21ss/DIS2/Lecture Material/playlist [Linked file]
11.0kiB [00:00, 2.97MiB/s]

The section data is:

Click to expand ``` ------SECTION-DATA------ { "id": 133036, "name": "Lecture Material", "visible": 1, "summary": "", "summaryformat": 1, "section": 1, "hiddenbynumsections": 0, "uservisible": true, "modules": [ { "id": 550569, "url": "https://moodle.rwth-aachen.de/mod/url/view.php?id=xxxxxxx", "name": "Lecture Videos", "instance": 40344, "visible": 1, "uservisible": true, "visibleoncoursepage": 1, "modicon": "https://moodle.rwth-aachen.de/theme/image.php/boost_campus_rwth/url/1620192730/icon", "modname": "url", "modplural": "Links/URLs", "indent": 0, "onclick": "", "afterlink": null, "customdata": "\"\"", "noviewlink": false, "completion": 0, "contents": [ { "type": "url", "filename": "Lecture Videos", "filepath": null, "filesize": 0, "fileurl": "https://www.youtube.com/playlist?list=xxxxxxx", "timecreated": null, "timemodified": 1617792262, "sortorder": null, "userid": null, "author": null, "license": null } ], "contentsinfo": { "filescount": 1, "filessize": 0, "lastmodified": 1617792262, "mimetypes": [], "repositorytype": "" } } ] } ```

Both links with the xxxxxxx inside redirects to the playlist

Romern commented 3 years ago

I think I fixed the issue in https://github.com/Romern/syncMyMoodle/commit/6521d7ec669a44981bcb51ca5b5789e9ccc79bb9

autoantwort commented 3 years ago

Unfortunately the same result

autoantwort commented 3 years ago

Output:

Downloading files...
Downloading /Users/leanderSchulten/RWTH/Moodle/21ss/DIS2/Lecture Material/playlist [Linked file [application/binary]]
11.0kiB [00:00, 5.39MiB/s]
Romern commented 3 years ago

The problem was that youtube playlist links would return the wrong content-type when using HEAD request, so I wrote a workaround for it: https://github.com/Romern/syncMyMoodle/commit/f5ca5e94d7b027bcb1dd79f34e803031d6a4710c . This should fix the issue (worked for the playlist I had in our testroom).

autoantwort commented 3 years ago

Yeah that works 👍 , than I can close my PR #44