FallingLights / Teachable-dl

Course downloader for teachable platform written in python3 using selenium and yt-dlp
GNU Lesser General Public License v3.0
106 stars 27 forks source link

[BUG] No video downloads #29

Closed PrivacySmurf closed 9 months ago

PrivacySmurf commented 9 months ago

Describe the bug When accessing a course, the HTML pages are created for the course sections, but no video is downloaded, and warning/error messages pop up.

I can successfully bypass Cloudflare and automatically log in to the course URL. Once the folders are created and navigated to the first section of the course, the HTML page is successfully created, and I assume the video is downloaded afterward. At this point, there are warnings as follows.

WARNING: No attachments found for video: Welcome!-(6-55-) [generic] Extracting URL: https://vod-akm.play.hotmart.com/video/rRAWPmGkL1/hls/master-t-1649091442001.m3u8?hdnts=st%3D1698...e8-9725-e0efc7b5d29c [generic] master-t-1649091442001: Downloading webpage ERROR: [generic] Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U WARNING: Could not download subtitle: Welcome!-(6-55-) cause: ERROR: [generic] Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: Forbidden>); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U WARNING: Could not download subtitle: Welcome!-(6-55-) cause: local variable 'info_json' referenced before assignment [generic] Extracting URL: https://vod-akm.play.hotmart.com/video/rRAWPmGkL1/hls/master-t-1649091442001.m3u8?hdnts=st%3D1698...e8-9725-e0efc7b5d29c [generic] master-t-1649091442001: Downloading webpage

Additional context I have followed all the installation instructions and requirements and for sure have the latest version of yt-dlp. When looking into that package github there's a issue that I THINK may be related but I'm not sure.

https://github.com/yt-dlp/yt-dlp/issues/8397

Regardless of course URL, no videos are downloading but HTML pages are being collected properly.

totalitarian commented 9 months ago

same issue here

Ex-Communicad0 commented 9 months ago

@FallingLights instead of using yt-dlp to download can you implement an executable downloader like N_m3u8DL-RE

it helps downlaod from main m3u8 link extracts all the subtitle, audio & video

also the video quality bitrate remains same as source

Ex-Communicad0 commented 9 months ago

Ok so found out the downloader needs to pass with header without header you will get 403 forbidden error watch this screenshot

screenshot

totalitarian commented 9 months ago

yes it seems referer needs adding in main.py

add

+ "Referer": "https://player.hotmart.com"

as shown below

class TeachableDownloader:
    def __init__(self, verbose_arg=False, complete_lecture_arg=False):
        self.chrome_options = uc.ChromeOptions()
        self.driver = uc.Chrome(options=self.chrome_options)
        self.headers = {
            "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
            "Origin": "https://player.hotmart.com",
            "Referer": "https://player.hotmart.com"
        }
FallingLights commented 9 months ago

@Thoxy67, thanks for suggesting N_m3u8DL-RE as an alternative; it sounds like a powerful tool. I appreciate the recommendation! For the time being, I've managed to resolve the issues with yt-dlp, so I'll be sticking with that. But I'll definitely keep N_m3u8DL-RE in mind for future reference.

FallingLights commented 9 months ago

@Thoxy67, thanks a ton for pointing out the necessity to add the 'Referer' header. I've implemented the change in the commit 5059fde, and it's working perfectly for me.