Running youtube-dl on a server #190

Closed
opened 2026-02-20 21:05:06 -05:00 by deekerman · 3 comments
Owner

Originally created by @jasperamorgan on GitHub (Dec 13, 2011).

I'm writing a bookmarking tool to create playlists of online video which can be played from local media players.

For Youtube videos I am extracting the actual video URLs using Youtube-dl running on a server which get passed to the media player.

This works great running in a local development environment but when the URL is extracted from the production server (running on EC2), I get a 403 error. (BTW, as per issue #41 I'm passing the cookie to the media player which works fine.)

Could it be an issue that the URL is being extracted and then used on machines running in different networks?

Originally created by @jasperamorgan on GitHub (Dec 13, 2011). I'm writing a bookmarking tool to create playlists of online video which can be played from local media players. For Youtube videos I am extracting the actual video URLs using Youtube-dl running on a server which get passed to the media player. This works great running in a local development environment but when the URL is extracted from the production server (running on EC2), I get a 403 error. (BTW, as per issue #41 I'm passing the cookie to the media player which works fine.) Could it be an issue that the URL is being extracted and then used on machines running in different networks?
Author
Owner

@phihag commented on GitHub (Dec 15, 2011):

This depends on the video service you're downloading from. In particular, youtube is known to require extractor (i.e. youtube-dl) and downloader to be in the same /24 IPv4 network. Many video services (youtube included) also require cookies, and may require the same User-Agent string and other characteristics.

I think you have options here:

  1. Download the videos on the server, and re-serve them.
  2. Run youtube-dl on the client, i.e. pass youtube/video service URLs unmodified.
  3. Somehow get client and server into the same network.
  4. youtube only: Download via IPv6, where these rules don't seem to apply. Note that extraction will be IPv4 unless you're specifically whitelisted by google.

I'm marking this issue as closed as I don't think there is anything youtube-dl can do here (apart from clearly documenting one needs to transfer cookies and such). This doesn't mean we can't discuss it; I'll reopen the issue once there is a specific problem with youtube-dl, or a problem that can't be solved by one of the above setups.

@phihag commented on GitHub (Dec 15, 2011): This depends on the video service you're downloading from. In particular, youtube is known to require extractor (i.e. youtube-dl) and downloader to be in the same /24 IPv4 network. Many video services (youtube included) also require cookies, and may require the same User-Agent string and other characteristics. I think you have options here: 1. Download the videos on the server, and re-serve them. 2. Run youtube-dl on the client, i.e. pass youtube/video service URLs unmodified. 3. Somehow get client and server into the same network. 4. youtube only: Download via IPv6, where these rules don't seem to apply. Note that extraction will be IPv4 unless you're specifically whitelisted by google. I'm marking this issue as closed as I don't think there is anything youtube-dl can do here (apart from clearly documenting one needs to transfer cookies and such). This doesn't mean we can't discuss it; I'll reopen the issue once there is a specific problem with youtube-dl, or a problem that can't be solved by one of the above setups.
Author
Owner

@jasperamorgan commented on GitHub (Dec 16, 2011):

Hi Philipp,

thanks for taking time to respond and confirming my suspicion that
extraction and playback need to happen on the same network. I agree that
this falls outside the scope of youtube-dl. I'll take a shot at getting
the extractor to pass in the network address of the client to see if
youtube can be fooled into thinking that extraction and playback happen
from the same network.

mfg

Jasper

On 15 December 2011 14:03, Philipp Hagemeister <
reply@reply.github.com

wrote:

This depends on the video service you're downloading from. In particular,
youtube is known to require extractor (i.e. youtube-dl) and downloader to
be in the same /24 IPv4 network. Many video services (youtube included)
also require cookies, and may require the same User-Agent string and other
characteristics.

I think you have options here:

  1. Download the videos on the server, and re-serve them.
  2. Run youtube-dl on the client, i.e. pass youtube/video service URLs
    unmodified.
  3. Somehow get client and server into the same network.
  4. youtube only: Download via IPv6, where these rules don't seem to apply.
    Note that extraction will be IPv4 unless you're specifically whitelisted by
    google.

I'm marking this issue as closed as I don't think there is anything
youtube-dl can do here (apart from clearly documenting one needs to
transfer cookies and such). This doesn't mean we can't discuss it; I'll
reopen the issue once there is a specific problem with youtube-dl, or a
problem that can't be solved by one of the above setups.


Reply to this email directly or view it on GitHub:
https://github.com/rg3/youtube-dl/issues/248#issuecomment-3161289

@jasperamorgan commented on GitHub (Dec 16, 2011): Hi Philipp, thanks for taking time to respond and confirming my suspicion that extraction and playback need to happen on the same network. I agree that this falls outside the scope of youtube-dl. I'll take a shot at getting the extractor to pass in the network address of the client to see if youtube can be fooled into thinking that extraction and playback happen from the same network. mfg Jasper On 15 December 2011 14:03, Philipp Hagemeister < reply@reply.github.com > wrote: > > This depends on the video service you're downloading from. In particular, > youtube is known to require extractor (i.e. youtube-dl) and downloader to > be in the same /24 IPv4 network. Many video services (youtube included) > also require cookies, and may require the same User-Agent string and other > characteristics. > > I think you have options here: > 1. Download the videos on the server, and re-serve them. > 2. Run youtube-dl on the client, i.e. pass youtube/video service URLs > unmodified. > 3. Somehow get client and server into the same network. > 4. youtube only: Download via IPv6, where these rules don't seem to apply. > Note that extraction will be IPv4 unless you're specifically whitelisted by > google. > > I'm marking this issue as closed as I don't think there is anything > youtube-dl can do here (apart from clearly documenting one needs to > transfer cookies and such). This doesn't mean we can't discuss it; I'll > reopen the issue once there is a specific problem with youtube-dl, or a > problem that can't be solved by one of the above setups. > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/rg3/youtube-dl/issues/248#issuecomment-3161289
Author
Owner

@maurrubio commented on GitHub (Aug 21, 2014):

@jasperamorgan Did you manage to solve this issue?

@maurrubio commented on GitHub (Aug 21, 2014): @jasperamorgan Did you manage to solve this issue?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl#190
No description provided.