Discussion:
yt-dlp usage of --xff argument
(too old to reply)
j***@astraweb.com
2024-05-21 14:10:04 UTC
Permalink
Has anyone had any luck with the yt-dlp argument --xff ?

I have tried every permutation i could think of testing with a country code of bg and then ru .

so, what is the exact syntax that works for you?

Does it have to used in conjunction with another argument?

~~~~~

Geo-restriction:
--geo-verification-proxy URL Use this proxy to verify the IP address for
some geo-restricted sites. The default proxy
specified by --proxy (or none, if the option
is not present) is used for the actual
downloading
--xff VALUE How to fake X-Forwarded-For HTTP header to
try bypassing geographic restriction. One of
"default" (only when known to be useful),
"never", an IP block in CIDR notation, or a
two-letter ISO 3166-2 country code
~~~~~~~

(yt is a batch file that executes %YT% which is .exe yt-dlp with some boiler plate arguments which was
set in the child environment by another .bat)


here is a sample of tries that did not work:

~~~~~~~
c:\youtube-dl_ 9:30:18.17_>yt --xff bg "https://ok.ru/video/4062987880968"

c:\youtube-dl_ 9:30:27.14_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff bg
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region

c:\youtube-dl_ 9:30:32.11_>yt --xff ru "https://ok.ru/video/4062987880968"

c:\youtube-dl_ 9:30:47.81_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff ru
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region

c:\youtube-dl_ 9:30:51.70_>yt --xff 'ru' "https://ok.ru/video/4062987880968"

c:\youtube-dl_ 9:31:11.27_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff 'ru'
"https://ok.ru/video/40629878809
68"

Usage: yt-dlp [OPTIONS] URL [URL...]

yt-dlp: error: Unsupported --xff "'ru'"

c:\youtube-dl_ 9:31:13.62_>yt --xff .ru "https://ok.ru/video/4062987880968"

c:\youtube-dl_ 9:38:58.64_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff .ru
"https://ok.ru/video/406298788096
8"

Usage: yt-dlp [OPTIONS] URL [URL...]

yt-dlp: error: Unsupported --xff ".ru"

c:\youtube-dl_ 9:39:00.65_>

~~~~~~
JJ
2024-05-22 00:29:07 UTC
Permalink
Post by j***@astraweb.com
Has anyone had any luck with the yt-dlp argument --xff ?
I have tried every permutation i could think of testing with a country code of bg and then ru .
so, what is the exact syntax that works for you?
Does it have to used in conjunction with another argument?
~~~~~
--geo-verification-proxy URL Use this proxy to verify the IP address for
some geo-restricted sites. The default proxy
specified by --proxy (or none, if the option
is not present) is used for the actual
downloading
--xff VALUE How to fake X-Forwarded-For HTTP header to
try bypassing geographic restriction. One of
"default" (only when known to be useful),
"never", an IP block in CIDR notation, or a
two-letter ISO 3166-2 country code
~~~~~~~
(yt is a batch file that executes %YT% which is .exe yt-dlp with some boiler plate arguments which was
set in the child environment by another .bat)
~~~~~~~
c:\youtube-dl_ 9:30:18.17_>yt --xff bg "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:27.14_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff bg
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:32.11_>yt --xff ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:47.81_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff ru
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:51.70_>yt --xff 'ru' "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:31:11.27_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff 'ru'
"https://ok.ru/video/40629878809
68"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff "'ru'"
c:\youtube-dl_ 9:31:13.62_>yt --xff .ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:38:58.64_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff .ru
"https://ok.ru/video/406298788096
8"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff ".ru"
c:\youtube-dl_ 9:39:00.65_>
~~~~~~
X-Forwarded-For HTTP header's value is an IP address. Not country code.

But the chance of the effectiveness of spoofed X-Forwarded-For HTTP header
is quite slim, since servers will use the IP address from both the header as
well as the connection. If one of them is geo restricted, the request will
be blocked.
JJ
2024-05-22 00:31:50 UTC
Permalink
Post by JJ
Post by j***@astraweb.com
Has anyone had any luck with the yt-dlp argument --xff ?
I have tried every permutation i could think of testing with a country code of bg and then ru .
so, what is the exact syntax that works for you?
Does it have to used in conjunction with another argument?
~~~~~
--geo-verification-proxy URL Use this proxy to verify the IP address for
some geo-restricted sites. The default proxy
specified by --proxy (or none, if the option
is not present) is used for the actual
downloading
--xff VALUE How to fake X-Forwarded-For HTTP header to
try bypassing geographic restriction. One of
"default" (only when known to be useful),
"never", an IP block in CIDR notation, or a
two-letter ISO 3166-2 country code
~~~~~~~
(yt is a batch file that executes %YT% which is .exe yt-dlp with some boiler plate arguments which was
set in the child environment by another .bat)
~~~~~~~
c:\youtube-dl_ 9:30:18.17_>yt --xff bg "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:27.14_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff bg
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:32.11_>yt --xff ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:47.81_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff ru
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:51.70_>yt --xff 'ru' "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:31:11.27_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff 'ru'
"https://ok.ru/video/40629878809
68"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff "'ru'"
c:\youtube-dl_ 9:31:13.62_>yt --xff .ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:38:58.64_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff .ru
"https://ok.ru/video/406298788096
8"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff ".ru"
c:\youtube-dl_ 9:39:00.65_>
~~~~~~
X-Forwarded-For HTTP header's value is an IP address. Not country code.
But the chance of the effectiveness of spoofed X-Forwarded-For HTTP header
is quite slim, since servers will use the IP address from both the header as
well as the connection. If one of them is geo restricted, the request will
be blocked.
Also, the header can't be spoofed if non anonymous proxy is used, since the
header is set by the proxy server.
JJ
2024-05-22 00:35:57 UTC
Permalink
Post by JJ
X-Forwarded-For HTTP header's value is an IP address. Not country code.
My bad. The argument value is a country code.

But the reason for why it may not work is as already mentioned.
j***@astraweb.com
2024-05-23 13:38:36 UTC
Permalink
Post by JJ
Post by JJ
Post by j***@astraweb.com
Has anyone had any luck with the yt-dlp argument --xff ?
I have tried every permutation i could think of testing with a country code of bg and then ru .
so, what is the exact syntax that works for you?
Does it have to used in conjunction with another argument?
~~~~~
--geo-verification-proxy URL Use this proxy to verify the IP address for
some geo-restricted sites. The default proxy
specified by --proxy (or none, if the option
is not present) is used for the actual
downloading
--xff VALUE How to fake X-Forwarded-For HTTP header to
try bypassing geographic restriction. One of
"default" (only when known to be useful),
"never", an IP block in CIDR notation, or a
two-letter ISO 3166-2 country code
~~~~~~~
(yt is a batch file that executes %YT% which is .exe yt-dlp with some boiler plate arguments which was
set in the child environment by another .bat)
~~~~~~~
c:\youtube-dl_ 9:30:18.17_>yt --xff bg "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:27.14_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff bg
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:32.11_>yt --xff ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:47.81_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff ru
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:51.70_>yt --xff 'ru' "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:31:11.27_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff 'ru'
"https://ok.ru/video/40629878809
68"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff "'ru'"
c:\youtube-dl_ 9:31:13.62_>yt --xff .ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:38:58.64_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff .ru
"https://ok.ru/video/406298788096
8"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff ".ru"
c:\youtube-dl_ 9:39:00.65_>
~~~~~~
X-Forwarded-For HTTP header's value is an IP address. Not country code.
But the chance of the effectiveness of spoofed X-Forwarded-For HTTP header
is quite slim, since servers will use the IP address from both the header as
well as the connection. If one of them is geo restricted, the request will
be blocked.
Also, the header can't be spoofed if non anonymous proxy is used, since the
header is set by the proxy server.
OK. I will keep that in mind.

I am trying to get out of the necessity of a VPN. Maybe I can find a cloud server download service in
one of the correct countries.

On the cloud server, I am thinking that one in the former Eastern Bloc countries will be on allowed
region list to allow Hollywood movies to DL.

I have a feeling that OK.RU has an agreement for $$ with Sony/Columbia to block their recent movies for
the region I am in.

--

jim

j***@astraweb.com
2024-05-23 13:23:02 UTC
Permalink
Post by JJ
Post by j***@astraweb.com
Has anyone had any luck with the yt-dlp argument --xff ?
I have tried every permutation i could think of testing with a country code of bg and then ru .
so, what is the exact syntax that works for you?
Does it have to used in conjunction with another argument?
~~~~~
--geo-verification-proxy URL Use this proxy to verify the IP address for
some geo-restricted sites. The default proxy
specified by --proxy (or none, if the option
is not present) is used for the actual
downloading
--xff VALUE How to fake X-Forwarded-For HTTP header to
try bypassing geographic restriction. One of
"default" (only when known to be useful),
"never", an IP block in CIDR notation, or a
two-letter ISO 3166-2 country code
~~~~~~~
(yt is a batch file that executes %YT% which is .exe yt-dlp with some boiler plate arguments which was
set in the child environment by another .bat)
~~~~~~~
c:\youtube-dl_ 9:30:18.17_>yt --xff bg "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:27.14_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff bg
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:32.11_>yt --xff ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:30:47.81_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff ru
"https://ok.ru/video/4062987880968
"
[Odnoklassniki] Extracting URL: https://ok.ru/video/4062987880968
[Odnoklassniki] 4062987880968: Downloading desktop webpage
[Odnoklassniki] 4062987880968: Downloading mobile webpage
ERROR: [Odnoklassniki] 4062987880968: This video is not available in your region
c:\youtube-dl_ 9:30:51.70_>yt --xff 'ru' "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:31:11.27_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff 'ru'
"https://ok.ru/video/40629878809
68"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff "'ru'"
c:\youtube-dl_ 9:31:13.62_>yt --xff .ru "https://ok.ru/video/4062987880968"
c:\youtube-dl_ 9:38:58.64_>yt-dlp --socket-timeout 3600 -i --sub-langs "en." --xff .ru
"https://ok.ru/video/406298788096
8"
Usage: yt-dlp [OPTIONS] URL [URL...]
yt-dlp: error: Unsupported --xff ".ru"
c:\youtube-dl_ 9:39:00.65_>
~~~~~~
X-Forwarded-For HTTP header's value is an IP address. Not country code.
But the chance of the effectiveness of spoofed X-Forwarded-For HTTP header
is quite slim, since servers will use the IP address from both the header as
well as the connection. If one of them is geo restricted, the request will
be blocked.
Thanks for that info. The argument description did imply that it might not work.

I will continue testing on the basis of what you have said.

--

jim
Loading...