Failure to open YouTube videos "Could Not Open Location; you might not have permission to play the file." misleading

Bug #323649 reported by Yige on 2009-01-31
168
This bug affects 30 people
Affects Status Importance Assigned to Milestone
GStreamer
Expired
Wishlist
Totem
Fix Committed
Undecided
Mearaj Bhagad
gstreamer0.10 (Ubuntu)
Low
Ubuntu Desktop Bugs

Bug Description

Binary package hint: totem

My saved Youtube playlist files will not open on occasion. Mostly when I reset my router or log back in 1day later.

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 8.10
ExecutablePath: /usr/bin/totem-gstreamer
Package: totem-gstreamer 2.24.3-0ubuntu1
ProcEnviron:
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: totem
Uname: Linux 2.6.27-9-generic i686

Sebastien Bacher (seb128) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please answer these questions:

 * Is this reproducible?
 * If so, what specific steps should we take to recreate this bug?

 This will help us to find and resolve the problem.

Changed in totem:
assignee: nobody → desktop-bugs
importance: Undecided → Low
status: New → Incomplete
Jonas (peace-dammit) wrote :

Sounds like a duplicate of #25146

Jonas (peace-dammit) wrote :

Also check bug #288494

I hope this is the right place for me to reply.

It's possible to save all your favorite youtube videos in a playlist.pls file. And whenever you restart your PC it's easy
to open that file and listen to them again.

But if you ever Unplug your router, hub, or however you link to the internet you will not be able to refer back to your
saved playlist.

Oh and I am on a wireless connection (DELL Laptop).
Every now and then I have to reconnect using the user friendly Network Manager.

Ok let me clear that up.

REPRODUCE PROBLEM
I am mainly on a wireless connection to my router (http://www.2wire.com) , which connects all my devices to the internet. But sometimes I lose my connection. Maybe my service provider had problems or maybe I'm having software problems. Whenever I lose connection to the internet I have to restart my wireless router or sometimes I can just use Ubuntu's Network Manager to reconnect.

MAIN PROBLEM
Whenever I reset my internet connection my Youtube playlist becomes useless in the Ubuntu 8.10 Totem Movie Player.

Shawn (ogarro) wrote :

I can confirm this bug by simply creating a playlist of YouTube videos and optionally save it to disk. even if you just leave the list playing without actually saving it and reopening it later, after some time you will not be able to play any of the links. I think it might have something to do with YouTube sessions timing out. because you search for the same video and add it to the play list, you get a different url.

Maybe a developer or maintainer of the plugin can shed some light on what might be the reason, but I think youtube links are bound to session which expire after some time, never to be used again.

Changed in totem:
status: Incomplete → Triaged
Changed in totem:
status: Unknown → New
Andrew (and471) on 2009-08-26
Changed in totem:
status: New → Confirmed
taka k. (scar) wrote :

it looks like this is moving along to be fixed, but i thought i would post my simple findings.

basically, i just cannot watch any youtube videos. i'm not using anything fancy like playlists, etc. i'm just searching for a youtube video, and then double-clicking on the results, then i get the error message mentioned in the title of this bug report. this has been happening for every video i've been trying to play.

i notice from the other posts that this may be network related. so, i will tell you i am using a laptop which has a wireless card in it. it is associated with my AP and connects automatically upon bootup. however, due to the instability of it (it is based on the ralink rt2860 chipset), i have hardwired my laptop to my router with a cat-5 cable. upon bootup, i usually disable the wireless by selecting that option from the right-click menu of the network manager icon, forcing the laptop to use the ethernet. so that might be causing some problem. however, i've been using this method for some time and i don't think i've had problems with totem/youtube for that long........

Peter Shepherd (petershepherd) wrote :

I am having the same problem with as the last user. In a previous installation on my laptop with Ubuntu, which was Jaunty Jackalope when it was first released, I was not having this problem, but I recently reinstalled the Operating System on my laptop, and have tried it on several computers in my home, and get the same problem.
When I double click on the YouTube picture in the side panel, a window pops up, saying: Could not open location; you might not have permission to open the file.

The terminal output I get is:

** Message: Error: "http://www.youtube.com/get_video?video_id=e-EGzskcdp0&t=vjVQa1PpcFMipjwwUg-lx8shgNz0AJXFbSQ1Bb3oWuQ%253D&fmt=18": Not Found
gstsouphttpsrc.c(980): gst_soup_http_src_parse_status (): /GstPlayBin:play/GstSoupHTTPSrc:source:
404 Not Found

Or Cohen (lightpriest) wrote :

This problem apparently because youtube uses a forward slash in their "t" param.
On the youtube.py (the plugin itself), the url is built with a urllib.quote of pythin which escapes this forward slash with a %25.
I guess gst's API shouldn't "unescape" these URL's and this is a youtube plugin bug.

I've noticed this plugin was replaced with a C one (in gnome's git repo) and they had the same escape method there.

Attached a suggested patch.

Or Cohen (lightpriest) wrote :

Some errors in the previous comment.

The added character is the "%" sign in the "t" param, and urllib.quote escapes that with a %25.

Sebastien Bacher (seb128) wrote :

Thank you for your work there, the issue should already be fixed in karmic though, could you confirm that's working?

NikeSLR (stepanov-dz) wrote :

that patch works! Thanks a lot, folks!

Changed in totem (Ubuntu):
status: Triaged → Fix Committed
Sebastien Bacher (seb128) wrote :

Changing the bug to triaged again, there was an another bug about the feature not working which has been closed, this one is about the error message not being clear to users

Changed in totem (Ubuntu):
status: Fix Committed → Triaged
renardrusse (renardrusse) wrote :

I have the same problem that I can t watch a youtube video in totem it said location not found.

I m new on linux ubuntu I d like to try the patch that lightpriest sent, but I don t know how to instal it. When I click on the link it open a window where I can read:

# totem-plguins (2.26.1-0ubuntu5)
# Patch for YouTube plugin
# Written for ubuntu users everywhere (from the ubuntu-il community) :)
# File: /usr/lib/totem/plugins/youtube/youtube.py
# Apply with: "sudo patch /usr/lib/totem/plugins/youtube/youtube.py totem_plugins_youtube.py.patch"

337c337
< mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + urllib.quote (t_param) + self.get_fmt_string ()
---
> mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + t_param + self.get_fmt_string ()

What can I do with that?

CiscoReject (ciscoreject) wrote :

As a relatively new Ubuntu user, I was pleased to work this out :)

This line is currently in the config

< mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + urllib.quote (t_param) + self.get_fmt_string ()

This line is what the line above needs to be amended to

> mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + t_param + self.get_fmt_string ()

To do this - i saved this patch link to my documents folder first. don't need to, but i just found it easier. open it in text editor.

Close Movie player

browse to "/usr/lib/totem/plugins/youtube" and make a copy of this file (I lasily just copied it to the desktop using the GUI, but I guess any CLI equivilant command would work just as well)

open the terminal from Applications - Accessories - Terminal - and type "cd /usr/lib/totem/plugins/youtube"

once you are in the youtube directory, type "gksudo gedit youtube.py" which opens the config file with admin privs (so you can save it later)

within the file just opened, search for the original line shown in the patch (I just searched for "mrl" - it's near the bottom) - then copy and paste the new line, replacing the old one

i.e: mine now looks like this
****
"""Get the video stream MRL"""
  t_param = self.resolve_t_param (youtube_id)

  if t_param != "":
   mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + t_param + self.get_fmt_string ()

  gobject.idle_add (self._append_to_liststore, treeview_name, pixbuf, entry.title.text, mrl, youtube_id, search_token)
****

now save the file and close it. open Movie Player, and you should be able to search for YouTube Videos and play them fine. If you have any probs, you can always revert back to the original file you made a copy of and try again.

Hope that helps, sorry if it's a bit patronising

Thanks to lightpriest for the patch! Works a treat! :)

chomik2b (chomik2b) wrote :

Great stuff!

Thanks for the patch lightpriest!... and for the "easy mode" CiscoReject!

Works perfect now!

affects: totem (Ubuntu) → gstreamer0.10 (Ubuntu)
Changed in totem:
importance: Unknown → Undecided
status: Confirmed → New
status: New → Invalid
Sebastien Bacher (seb128) wrote :

unsetting the patch tag since the change is not for the issue described on this bug

Changed in gstreamer:
status: Unknown → Incomplete
Pedro Villavicencio (pedro) wrote :

upstream is asking for more information, could somebody having the issue run totem as: GST_DEBUG=*:4 totem &> totem-debug.txt ; reproduce the issue and compress that file and attach it to the report? That'd help a lot to resolve the issue, thanks in advance.

Changed in gstreamer0.10 (Ubuntu):
status: Triaged → Incomplete
Pedro Villavicencio (pedro) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to New. Thanks again!.

Changed in gstreamer:
status: Incomplete → Invalid
Changed in gstreamer0.10 (Ubuntu):
status: Incomplete → Invalid
eiver (eiver) wrote :

The requested debug log after trying to play with Totem 2.30.2 On Linux Mint 9 x64 (based on Ubuntu Lucid).

Changed in gstreamer0.10 (Ubuntu):
status: Invalid → New
Changed in totem:
status: Invalid → New
Jon (jlander) wrote :

 I am running lucid ubuntu 64 sidebar in totem shows the videos but when i hit play i get this error Could not open location; you might not have permission to open the file.Well back to mini tube as a alternative..................

Jon (jlander) wrote :

After searching it seems to be youtube breaking links but i can still right click on the video in totem sidebar and open it in my browser good enough cause my alternative is broken too :o

Matthias G. (matgnt) wrote :

Same here. Also Lucid 64. It has been working for a long time, but suddenly the above error occurred.

eiver (eiver) wrote :

Indeed the problem cause was youtube changed their links. One line of changes fixes the problem for Totem 2.30.2.

Caution:
This is my very first fix for anything under Linux.
I learned how to compile the source code under Linux yesterday.
The fix should be verified by a more experienced developer.

Changed in gstreamer0.10 (Ubuntu):
status: New → Invalid
Changed in totem:
status: New → Fix Committed
tags: added: patch
Jon (jlander) on 2010-07-30
Changed in totem:
status: Fix Committed → Fix Released
Myzeus (myzeus) wrote :

Which line and which file am I supposed to change with the patch?

Or should I wait a new Totem package in the repos?

eiver (eiver) wrote :

That depends on you. You can wait until its in the repos, or do it yourself. I prefer to have an official version from the repos together with the patched version (in case I screw something in the source code).

The file is in totem-2.30.2.tar.bz2 which can be downloaded from the main totem page.
Its located in: <your unpacked folder>/src/plugins/youtube/totem-youtube.c

These are the lines used to construct the movie uri:

529: video_uri_string = g_string_new ("http://www.youtube.com/get_video?video_id=");
530: g_string_append_uri_escaped (video_uri_string, video_id, NULL, TRUE);
531: g_string_append (video_uri_string, "&t=");
532: g_string_append_uri_escaped (video_uri_string, t_param, NULL, TRUE);
533: g_string_append (video_uri_string, fmt_param);

Youtube now requires a mendatory "&asv=" parameter in the uri, so you just need to add one line after the above code:

534: g_string_append (video_uri_string, "&asv=");

Changed in totem:
assignee: nobody → Mearaj Bhagad (mearajbhagad)
status: Fix Released → Incomplete
Rakel Gren (rakel-gren) wrote :

Please, this is too technical for me. I have ubuntu lucid, and I get the above message, even when i'm in 'youtube'-mode in totem. i have checked that youtube is enabled: edit < plugins..

read somewhere that if you don't have gnome-sth then it is expected this error.

But i just installed the whole ubuntu package, and it says totem now can play youtube, but it cant. how do I know what to do to solve it? I don't even understand this page - is there a fix here somewhere, the links I clicked on seems to be for programmers...?

A 1000 thanx to any one who can help...

eiver (eiver) wrote :

You have youtube plugin enabled and this is correct. The problem is, that youtube plugin itself contains an error (a bug). I have released a fix for this error (available above in this topic), but the fix is for programmers, because the error is located in the youtube plugins source code.

Someone responsible for Ubuntu repositories should pick up my fix, verify that it works and release it. An ordinary user should receive the fix automatically as one of the updates. No additional action necessary.

However for some reason nobody at Ubuntu bothered to release my fix to the Ubuntu repos and it has been more than a month since I released the fix. The only thing you can do is to kick someones ass at Ubuntu, so they can hurry up or you can learn a little bit about programming and apply my fix yourself on your computer.

Changed in totem:
status: Incomplete → Fix Committed
Rakel Gren (rakel-gren) wrote :

Thank you <3
I will do both!

Rakel Gren (rakel-gren) wrote :

Hi again,
I have now made some programming attempts. :-o
Managed quite a bit, I think, but couldn't fix the problem.

Firstly:
I located the the totem-2.30.2.tar.bz2 and downloaded it.
Opened the totem-youtube.c file (via browser) and copy pasted your patch to the right line, and it was saved.

But still same error message in totem.

I thought it might be because the file i edited is not the file 'assigned' to be used by totem? That totem still uses the old one?

So I extracted all the files. But that didn't help. So I'm thinking I need to 'connect' the new file somehow? searched 'computer' for the location of totem-youtube.c and there is only the one I downloaded...?

Help?

Secondly:

I've also tried the fix further up in this thread:

" < mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + urllib.quote (t_param) + self.get_fmt_string ()

> mrl = "http://www.youtube.com/get_video?video_id=" + urllib.quote (youtube_id) + "&t=" + t_param + self.get_fmt_string () "

But once i've opened the file mentioned:

   "open the terminal from Applications - Accessories - Terminal - and type "cd /usr/lib/totem/plugins/youtube"
    once you are in the youtube directory, type "gksudo gedit youtube.py" which opens the config file with admin privs (so you
    can save it later)
    within the file just opened, search for the original line shown in the patch (I just searched for "mrl" - it's near the bottom) -
   then copy and paste the new line, replacing the old one)"

 - its empty....

When I go to /usr/lib/totem/plugins/youtube in browser window, there is no youtube.py file there... I've searched file system and not found it.

Thirdly:
Does it matter that the two fixed are concerning two different versions of totem 2.26.1 and 2.30.2? I ve gone to totem in software center to find out which versionn I'm running, but found no informtion on it...

Also, learning from another thread; i can't watch videos at all, not in firefox links either. I've been prompted to search for plugins accepted and installed, without any change. So, I guess it is not (only) a totem problem. Sometimes it says sth about mountpoint alredy busy (?) more often 'do not have necessary permissions', and in totem too, and right clicking open in web browser

- IT WORKS! (Not in totem, but in firefox!). must've done something right :-)

Pedro Villavicencio (pedro) wrote :

this bug is closed, please follow up in bug 609855

Changed in gstreamer:
importance: Unknown → Wishlist
status: Invalid → Expired
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.