Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
prefer http over https #2364
prefer http over https #2364
Comments
|
I think you can replace By the way, which url are you using? in my case |
|
let me try your idea. I was using youtube.com, and I found it is random, even the same video, sometimes it is http, another day it is https |
|
What app are you making that needs youtube-dl to output URLs in http? It does not seem to be a responsible feature to lower security just because a person wants to not implement security in their own code. |
|
I also found it show https randomly. To replace |
|
"I also found it show https randomly. To replace https to http the server will response 403 to me." |
|
Or can you suggest another way to easily get the http url? thanks! |
|
The reason why we default to https is #739. |
|
@jaimeMF: #cp /path/to/youtube.py /path/to/youtube.py.bak ...Is enough to make youtube-dl to return prefectly playable and seekable non-secure http streams, that's why i was asking to provide a (non default) switch like -no-ssl. What do you think about it? I could try to make a patch if you think is worth to consider the idea. Thanks for your efforts and attention. |
|
Yes, mpv is a good alternative; i was speaking about a gui i develop Thanks 2014-03-15 14:04 GMT+01:00, Jaime Marquínez Ferrándiz
|
|
I try this in a script using curl, it does not work: youtube-dl -F $1 playerurl=$(youtube-dl -f $vidformat -g "$1") Only output is curl downloading the file: % Total % Received % Xferd Average Speed Time Time Time Current |
|
@jaimeMF Those patches seems quite simple and mantainable to me: Gozer youtube_dl # diff -u init.py /tmp/new.init.py --- __init__.py 2014-02-26 00:30:26.000000000 +0100
+++ /tmp/new.__init__.py 2014-03-17 13:20:14.874465206 +0100
@@ -253,7 +253,8 @@
'--ignore-config',
action='store_true',
help='Do not read configuration files. When given in the global configuration file /etc/youtube-dl.conf: do not read the user configuration in ~/.config/youtube-dl.conf (%APPDATA%/youtube-dl/config.txt on Windows)')
-
+ general.add_option('--no-https',
+ action='store_true', dest='nohttps', help='Use insecure http youtube video urls')
selection.add_option(
'--playlist-start',
@@ -759,6 +760,7 @@
'include_ads': opts.include_ads,
'default_search': opts.default_search,
'youtube_include_dash_manifest': opts.youtube_include_dash_manifest,
+ 'nohttps': opts.nohttps,
}
with YoutubeDL(ydl_opts) as ydl:Gozer youtube_dl # diff -u extractor/youtube.py /tmp/new.youtube.py --- extractor/youtube.py 2014-02-25 10:41:20.000000000 +0100
+++ /tmp/new.youtube.py 2014-03-17 13:28:37.321129343 +0100
@@ -1148,6 +1148,11 @@
player_url = None
# Get video info
+ if self._downloader.params.get('nohttps'):
+ http="http"
+ else:
+ http="https"
+
self.report_video_info_webpage_download(video_id)
if re.search(r'player-age-gate-content">', video_webpage) is not None:
self.report_age_confirmation()
@@ -1162,7 +1167,7 @@
'asv': 3,
'sts':'1588',
})
- video_info_url = 'https://www.youtube.com/get_video_info?' + data
+ video_info_url = http+'://www.youtube.com/get_video_info?' + data
video_info_webpage = self._download_webpage(video_info_url, video_id,
note=False,
errnote='unable to download video info webpage')
@@ -1170,7 +1175,7 @@
else:
age_gate = False
for el_type in ['&el=embedded', '&el=detailpage', '&el=vevo', '']:
- video_info_url = ('https://www.youtube.com/get_video_info?&video_id=%s%s&ps=default&eurl=&gl=US&hl=en'
+ video_info_url = (http+'://www.youtube.com/get_video_info?&video_id=%s%s&ps=default&eurl=&gl=US&hl=en'
% (video_id, el_type))
video_info_webpage = self._download_webpage(video_info_url, video_id,
note=False,For your convenience, i uploaded the modified files here: Thanks. |
|
@kokoko3k thanks for this patch, works fine! |
|
@kokoko3k You are clearly a genius -- I tried to re-install from scratch:
Returned error: Initialized empty Git repository in /dirname/dir/youtube-dl/git_project/youtube-dl/.git/ So I downloaded the zip file Unzipped it; then entered the "youtube-dl" directory and replaced the old "init.py" with your new version. Entered the "youtube-dl/extractor" directory and replaced "youtube.py" with your new version. Ran "make".
Received errors about program "pandoc" not being available. Commented related lines out in the makefile rather than waste time in dependency hell. Created empty "youtube-dl.1" file so that make could see and use it. Re-ran "make" again; it worked. Ran "make install".
It (seemed to) work. Ran youtube-dl to watch heart-warming "sloth hugs cat" video and received friendly error message instead:
Pressed "Enter" and after pause, received message:
Re-ran youtube-dl to watch sloth-on-cat love:
Returned error message:
If I was a superintelligent five-year-old who wanted to watch her favorite sloth terrorizing her favorite cat on Youtube using your patched version of youtube-dl, how would I make this work? P.S. Running "youtube-dl -g <url_here>" also still returns an "https://" URL. |
|
That patch is not official, so you won't get it from official "repos"; this mean that as you update youtube-dl you'll lose it. |
|
@kokoko3k -- Okay, good point... So I re-downloaded the sources from here: Then copied your files ("new.init.py" and "new.youtube.py") to the "youtube_dl/" and "youtube_dl/extractor" directories, respectively (and removed the "new." from their names, of course). Ran youtube-dl and it updated. Then I ran make and received this output:
The poor sloth and cat are waiting in Youtubeland, hoping that one day I'll be able to see their video... |
|
Since others are still asking about this, if anyone could give a step-by-step instruction set for making this patch work, it would be great... I'd really like to be able to use Youtube, and as far as I know (as of version 2014.03.20) the patch hasn't been integrated into the main version of youtube-dl yet. Thanks for your help. |
|
Since youtube-dl 2014.03.21 (update with |
|
Thanks for your efforts, 2014-03-21 0:43 GMT+01:00, Philipp Hagemeister notifications@github.com:
|
|
@kokoko3k I'm not sure, somebody mentioned that you can't seek in piped videos in mplayer. Note that you can already pipe the output with |
|
Yep, it was me to mention it :) 2014-03-21 11:30 GMT+01:00, Philipp Hagemeister notifications@github.com:
|
Hi
I make an app that take advantage of youtube-dl.
I found recently
when using ./youtube-dl -g http;//youtube.com/xxxxxxx
the URL returns https://....
However, my app could not process https in the near future.
Is there any way to return the http rather than https?
BRs,
Zongyao Qu