Wikipedia:Reference desk/Archives/Computing/2018 February 5

Computing desk
< February 4 << Jan | February | Mar >> February 6 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


February 5

edit

Another HTML question

edit

I've noticed something curious on a site I've been visiting (let me call it "www.site.com"). Going to www.site.com/directory/ gives (on that site) precisely the same result as going to www.site.com/directory/index.html as long as there is indeed in that directory an "index.html" file. On the other hand when such an "index.html" file does not exist in that directory, then going to www.site.com/directory/index.html gives a 404 page not found error and going to www.site.com/directory/ gives a directory listing. Is that completely standard HTML behavior? What I'm asking is: Does by default any "index.html" file in a directory become synonymous as a link to that directory? Can that be changed? For example is it possible to make say a "contents.html" file (instead of a "index.html" file) behave the same? What if there is an "index.html" in the directory but I want to force the link www.site/directory/ to give a directory listing nonetheless? Does the "index" file have to be an "html" file (not say an "htm" file)? Thanks. Basemetal 20:05, 5 February 2018 (UTC)[reply]

This behavior has nothing to do with HTML. It is just your web server. Ruslik_Zero 20:44, 5 February 2018 (UTC)[reply]
What you are describing is default Apache behavior. Apache is one webserver program. There are others. Some behave similar (though not exactly like) Apache. Some behave in an entirely different way. By default, if you do not declare a file, it will look for index.html and show it. If index.html does not exist, it will show a directory listing using default Apache icons for folders and files. If you declare a file that doesn't exist, such as index.html, you will get a 404 error. All of that can be customized. You can customize the default page to be a different file name or even a set of files. You can say "look for index.html or index.htm or index.php" if no file is given. You can customize the 404 error to go to an actual page. You can turn off directory listings or redirect directory listings to another page. A lot of people don't do that, but it is possible. 209.149.113.5 (talk) 20:45, 5 February 2018 (UTC)[reply]

Why can't I play embedded YouTube videos from webpages I've saved?

edit

I've saved a webpage which contains an embedded YouTube video. That video plays fine on the site I've saved it from. However when I try to play it from the copy saved to my hard disk, it never works. All I get is that stupid TV static screen containig the YouTube error message: "An error occurred. Please try again later. (Playback ID: <16 character playback ID>). Learn More". And the "Learn More" link is useless. Can someone help, or at least explain? Thanks. Basemetal 20:49, 5 February 2018 (UTC)[reply]

The webpage doesn't "contain" the Youtube video, it links to it. As you didn't actually download the video and saving the webpage to your hard drive probably broke the embedding mechanism, it doesn't work. You cannot download a Youtube video simply by saving the page. 78.0.213.2 (talk) 04:34, 6 February 2018 (UTC)[reply]

Despite the implication of the answer to my query just above, I of course know that the actual video data of the embedded YouTube video doesn't reside on my saved webpage or on the original webpage for that matter and that I'm not actually downloading a YouTube video simply by saving a webpage that has an embedded YouTube video. My use of the word "contain" did not mean to imply anything of the sort. I didn't say "contain a video" but "contains an embedded video". That might be ambiguous but I've seen that phrase used everywhere and everybody understands what it means. If anyone has a better way to say it, I'm open to suggestions. Again: I know it is just a link to the YouTube video which resides on the YouTube server. Whew. I hope that's clear and out of the way now.

However the error message comes from YouTube. YouTube is incapable or unwilling to play the link when the request comes from my saved page as opposed to when it comes from the original webpage and sends me an error message. Why? Is there a way to fix that? The statement that "saving the webpage [...] probably broke the embedding mechanism", whatever it means, is too vague to be useful, as it is basically tautological. Yes, I know something "broke". That's why I'm asking questions here. The "embedded video" is still there (you know what I mean, the YouTube screen) and the link to the YouTube video is there too (because I can save the link with "Copy video URL" and then play it fine if I open another window and use that URL) so what "broke" and why? . Again the link to the YouTube video is still there on my saved page because the error message obviously comes from YouTube and because I can play the URL saved from the "embedded video". If anyone can help please ignore the previous non-answer and let's start again.

Thanks a lot.

Basemetal 05:22, 6 February 2018 (UTC)[reply]

So are you saying that your saved webpage contains a link back to YouTube, and when you click that link, YouTube tells you it doesn't work? And if you copy the link URL and paste it to a web browser to go to YouTube directly, it works? In such a case, one thing that comes to my mind is HTTP referers. Most browsers use a HTTP header denoting the referer, meaning which site the link that caused the request was located at. It might be that YouTube expects the referer value to be something different than what gets sent when you click the link from your saved webpage. JIP | Talk 10:07, 6 February 2018 (UTC)[reply]
How can one check that? Could you check you get the same problem when you save a webpage with an embedded video? Just to confirm everybody's got the same problem, which would sort of confirm your guess. If you've got the time, could you try with this Memsaab's Story page which has this Daily Motion video embedded. First check the video plays fine on that page when it's on the Memsaab's Story site, then save the page and try to play the same video from the saved copy. If it works for you then it's gotta be something else. In this case the error message I get is "Whoa, hold up" and "Yikes! There's been a server error". Contrary to the YouTube case the error message appears immediately, before I even try to play the video. Thanks. Basemetal 14:10, 6 February 2018 (UTC)[reply]
PS: The YouTube video I was having problems with was on this page. But as I said, it seems to make absolutely no difference whatsoever if its YouTube, Dailymotion, Vimeo, or whatever. Basemetal 14:21, 6 February 2018 (UTC)[reply]
Yes, it's not working when I save the page as "Web page, complete". I get the video's start picture and a button on top of it, but the button does nothing. If I save as "Web page, HTML only" it works. The same behaviour as you have. It appears that the video is linked from a <video> element and not from a normal hyperlink, so I don't know if it even uses HTTP headers or HTTP in the first place. I tried saving a YouTube page as "Web page, complete" and it appeared completely blank in my browser. So I think it might be something more complicated than HTTP headers. JIP | Talk 19:35, 6 February 2018 (UTC)[reply]
  • This is because the world hates you and Donald Trump doesn't listen to Tim Berners-Lee.
In the TB-L web, "information wants to be, if not free, then at least neutral about it". YouTube would serve you a page of content, and links to content. If you saved that content (and the content that was at the far end of those links) then you could replay it offline. Clearly one can't do this.
One reason is streaming. There is no "content" at the end of those links, instead there is a server which dynamically serves portions of the content, as your playback client requests it. There just isn't any single monolithic downloadable resource for you to store. This is broadly a good thing - streaming allows us to watch the start of videos, or to skip to the middle, without first having to download and store the whole piece of content. With plausible values for bandwidth and storage space, this is much more useful, to more people. There are ways round this: the site may offer a different link, to a downloadable copy. Or you may use a client-side video downloader tool (there are many browser plug-ins) which can stream the video down, but also store it to such a format.
In the YouTube case though, it's because YouTube does not want you to download the videos. You might play them again without having to watch YouTube's ads. You might even upload them to a different site, taking away YouTube's business.
So the YouTube "web page" is far from a simple web page. It doesn't simply "link to" content (as TB-L's vision of an open web had it) it hides those links as closely as it can. It wraps them up in a client-side video player (maybe coded in Flash, or something equally opaque) to "improve the video watching experience" but mostly to keep them away from you. This player layer can impose DRM, location restrictions, age restrictions, or pay-per-view.
Trump's recent support of abandoning net neutrality means that this is the direction the web and internet are moving in. Expect to lose some YouTube content altogether - valuable content will instead retreat inside walled garden sites, where access needs to be bought. We're heading back to the days of AOL and Compuserve. Andy Dingley (talk) 10:31, 6 February 2018 (UTC)[reply]
Although Youtube does I believe use MPEG DASH, it is generally possible to get a link to a single file albeit not simply from the page. If you use something like KeepVid for example, you should normally be able to get a simple link which should be downloadable with any browser or even simply tools like Wget without plugins. (The site has Javascript which your browser runs to get the appropriate link.) The Youtube T&C (including for the API) do forbid downloads of this sort so, apps on Android, Windows Store, iTunes which allow such offline playback other than via the YouTube Red function do generally find themselves in trouble particularly if they are prominent e.g. Microsoft, Amazon. Plugins and third party software may do the same thing or they may have support for MPEG DASH or HTTP Live Streaming which may mean more quality options. Nil Einne (talk) 05:25, 7 February 2018 (UTC)[reply]
The browser's "save as" function saves a bit too much stuff. "Save as" fetches and saves a file from youtube.com. That file contains a bit of JavaScript that loads the embedded player. The JavaScript can't find the player because it doesn't know that it needs to go to youtube.com - it searches for it on your hard drive and fails. The JavaScript tells the browser "load the player from the same place you loaded this file", which is wrong when saved.
To fix, load the saved html file in a text editor. Find the line that starts <span class="embed-youtube". Open the original web page, do "view source" on it, and find the same line. Copy and paste the original line into the saved file. You'll notice there is a src="blah blah" - that is the bit that broke. 91.155.192.188 (talk) 16:40, 6 February 2018 (UTC)[reply]
I should have made clear I was saving the webpage on a computer running Windows 7 as "Webpage, Complete" because that's what caused the problems. When I save as "Webpage, HTML Only" then, as I've just realized, everything is fine and the video does play. So it is saving it as "Webpage, Complete" that breaks things. I discovered that by trying to follow your instructions and realizing I couldn't see the code you said. So when I save the page as simply an HTML file it works. Now the question is, is it possible to fix things so that even when I save as "Webpage, Complete" it will play the video? Because there are advantages to saving the page that way. For one thing if I save as an HTML file only then all the pictures are gone. The options "Webpage, HTML Only" and "Webpage, Complete" come from Explorer. I don't know what OS you're running. The JIP might be surprised to discover that on his Linux system everything works fine... Basemetal 17:21, 6 February 2018 (UTC)[reply]

Question: (regarding to Andy Dingley) this thing about streaming vs. loading the whole video. Could it also depend on the browser? I used to watch a video with the Task Manager window open. When using IE, the under Performance, the physical memory usage history (green line) goes uphill direction, until the computer slowly freezes, whereas when I view a video using Google Chrome, the memory usage line stays the same. So it seems like Chrome knows how to stream the video, but this is prolly with an older version of IE. Thanks. 12.130.157.65 (talk) 14:40, 8 February 2018 (UTC).[reply]

edit

My home computer's Linux system (Fedora 26) developed a strange problem just today. Whenever I click on any HTTP or HTTPS link in my e-mail, the browser goes to my home directory on my local computer (file:///home/jip/). The links themselves are OK, as copy-pasting the link to the browser works OK. Stopping and re-starting both the e-mail client and the browser didn't help. I use Evolution (3.24.6) as my e-mail client and Firefox (57.0.1) as my browser. Does anyone have any idea what is causing this? JIP | Talk 21:23, 5 February 2018 (UTC)[reply]

I use Thunderbird now, but when I used Evolution, I used xdg-settings to set the defaults. Try "xdg-settings --list" in your terminal to see if you have a default-url-scheme-handler and a default-web-browser set. There is no reason that the settings should have broke just to break. So, that is the confusing part. The goal is to track down the setting that borked and fix it. This is the starting point. My xdg default-web-browser is "Default web browser", which is the web browser set in my Xfce defaults. 209.149.113.5 (talk) 18:36, 6 February 2018 (UTC)[reply]
It appears that the problem might have started when I made Firefox my default browser in the Firefox preferences. But then I went to "Preferred applications" in GNOME preferences and explicitly checked Firefox as the preferred web browser (it originally showed "Preferred web browser", literally) and the problem went away. I went to the same preferences again, and the problem came back. It appears explicitly unselecting Firefox from the "Preferred applications" preferences and then explicitly selecting again fixes this. "xdg-settings --list" shows the same output every time, listing "Default web browser" as the default web browser. JIP | Talk 19:31, 6 February 2018 (UTC)[reply]