Unofficial Hacker News companion — get notified on comment replies, and more.

Best way to process a YouTube video/playlist on your website?

8 points by vivzkestrel 2 days ago 12 comments (opens Hacker News) Vote (opens Hacker News)

Comments (12)

  1. HaaaHaaa! this is exactly the issue i'm facing. fun to see it as the first post on ask page. "obviously yt-dlp is against terms of service from what i know" ---> If you're scraping and keeping the data, no one's stopping you. having said that i also haven't done it. If you are building a context pipeline I feel keeping the transcript(which you know is high quality) and the url is enough unless you want to download the video itself. Lemme know what you choose to do. I am also working on this exact workload.
    Replies (1)
    1. - well my app is more complicated

      - i need video frames to ocr

      - maybe i can process video to frames and send frames over to server directly or aws s3 bucket directly with video id as folder

      - not sure if there are better ways

      Replies (1)
      1. Sounds interesting. downloading the video is the hassle. better send the video url to the server and do all heavy things there. What is your ocr workflow? I have a use case that i had built previously but it wasn't very accurate. I tried to build a pullup counter which would classify bad form also but then that was beyond just a hassle and i gave it up, but now i feel with these system one workflows maybe these problem shapes can be approached but i haven't tried them.
        Replies (1)
        1. - if i send the url to the server, my backend would need to download it inside a worker.

          - this worker would have to use yt-dlp unless youtube api provides a way to download videos not belonging to your channel

          - the worker's IP address ll definitely get flagged by youtube after a few short runs

          - not to mention i have no idea what is the legality of doing this as a limited liability company

          - the workflow for ocr is simple, once i have the frames from input video, i can add a task to the queue with s3 image links per video id and any model such as paddle ocr, chandra etc can quickly perform the image analysis and send my express server back the results

          - the major bottleneck for me seems to be the process to get an mp4 out of youtube currently

          Replies (1)
          1. i dont think youtube will let you download the mp4 cause why would they. I am thinking about the download option youtube provides. When you download a video its in your system now right so it must be somewhere. IndexDB perhaps idk but if that can be salvaged you could lean into youtube's own feature for your requirement but then i dont think every video is downloadable. This will also allow you to keep your download and frame processing workload in the client side and only stream frames.
  2. Instead of grabbing the video, grab the transcript, if its available.

    Edit: I see from OP's comment, they actually want to OCR frames for text. From personal experience at a much smaller scale than what you're talking about, YT will probably nix that. Use a disposable Google account as it will likely get permanently banned.

    Replies (1)
    1. - sorry i did not get it, what does this disposable google account actually do?
      Replies (1)
      1. Reworded:

        This activity will probably get your Google account banned for violating their terms of use. Do not use an important Google account for this.

        Good luck. I did something similar and had legitimate fun working on the project and learned a lot.

  3. another way is to process it live while the user is viewing the video, so that it only occurs in the browser on the users computer. You just can't store any of the audio/video from the site, but you can process them live in the browser. I don't know if that will work for your web app, but it is what I did for my chrome extension which ran into the same issue. I needed to process the audio to be able to show pitch/tone of the speakers on youtube and i was able to do that effectively. Look for my chrome extension (speaktube) if you want to see it working, and i can give you more details on how i actually handled it on the code side if you want those details, just let me know.
    Replies (1)
    1. - let me take a look at speaktube and get back to you