Get YouTube Video (improved)
Dolphin Service Menus
Score 80%
Description:

Usage:
Right-click onto a link to a YouTube video or at the background of the YouTube site showing the video and choose action -> Download YouTube Video -> ...


About:
I made some modifications to the original YouTube Service Menu. It didn't work for me, so I looked at the source. I added a different method to guess the video_id and I added additional parameters to the query string to download the video.

With this Konqueror/KDE service menu it is possible to download a YouTube video
by right clicking a link to the video and choosing "Download YouTube Video" from the
actions menu.

For more details see:
http://bitbucket.org/panzi/youtube-service-menu/wiki/Home

See also the original version(s) of this script:
http://www.kde-apps.org/content/show.php?content=37509
http://www.kde-apps.org/content/show.php?content=41432

Note:
I don't use this script myself anymore because I now use this userscript (which I also made):
http://userscripts.org/scripts/show/98782

This means this script might not be maintained in the future.
Last changelog:

5 years ago

version 1.12a:
FIX: encoding problems

version 1.12:
NEW: chose format from menu with --format=ask.
NEW: --list option for Python script.
FIX: typos that made the script crash

version 1.11b:
FIX: Crash introduced in last version.

version 1.11a:
Updated greek translation. Thanks to Dimitrios Glentadakis.

version 1.11:
FIX: Extraction of video information. Now a different data extraction strategy
reading the flashvars of embed is used. Hopefully this is more stable.

version 1.10a:
ADD: Greek translation, thanks to Dimitrios Glentadakis (dglent)

version 1.10:
FIX: Extraction of video information. Now a different data extraction strategy
reading the flashvars of embed is used. Hopefully this is more stable.
DEP: New dependency to lxml: http://lxml.de/
NEW: Added video format 38: High Definition 3072p (mp4)

For more see:
http://bitbucket.org/panzi/youtube-service-menu/src/tip/Changelog

dglent

5 years ago

With the new version 1.12, to execute it, i had to change the shebang from python2 to python2.7

When i click on download, i have the follow message and the download does not start:
Traceback (most recent call last):
File "/usr/bin/get_yt_video.py", line 582, in main
file_info = get_filename(save_dir, video_id, select)
File "/usr/bin/get_yt_video.py", line 300, in get_filename
itag = showMenu(_("Save YouTube Video"),_("Chose format of »%(title)s« by »%(user)s«:") % video_info,menu)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 9: ordinal not in range(128)


If i click on download and play, it works

Report

dglent

5 years ago

This happens only when the video has a title with Greek words or mixed !
example:
http://www.youtube.com/watch?v=Wlz6rE4vPGQ

Report

C

panzi

5 years ago

Indeed. I noted it and will look into it when I've time.

Also for some reason I don't get notified when someone posts a new comment here. So if you want a bug to be noticed add it to the issue tracker (already did this for this bug): https://bitbucket.org/panzi/youtube-service-menu/issues?status=new&status=open

Report

dglent

5 years ago

ok, i ,subscribed to the project's tracker

thanks

Report

BJIacTeJIuH

1 year ago

A can add a submenu to choose video quality ??

Report

dglent

5 years ago

With the new version 1.12, to execute it, i had to change the shebang from python2 to python2.7

When i click on download, i have the follow message and the download does not start:
Traceback (most recent call last):
File "/usr/bin/get_yt_video.py", line 582, in main
file_info = get_filename(save_dir, video_id, select)
File "/usr/bin/get_yt_video.py", line 300, in get_filename
itag = showMenu(_("Save YouTube Video"),_("Chose format of »%(title)s« by »%(user)s«:") % video_info,menu)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 9: ordinal not in range(128)


If i click on download and play, it works

Report

KevinKofler

6 years ago

YouTube has changed some stuff again, which broke this tool. Other tools have already been updated.

Report

dglent

5 years ago

Yesterday was working fine but today it does nt work (?)

Report

dglent

5 years ago

I have the error message "expected string or buffer"

Report

C

panzi

5 years ago

For which video does this happen? What python version do you use?

Report

dglent

5 years ago

It happens in all videos i tried.
example: http://www.youtube.com/watch?v=aLEhh_XpJ-0

I have this message in the konsole:
Traceback (most recent call last):
File "/usr/bin/get_yt_video.py", line 504, in main
file_name, vid_url = get_filename(save_dir, video_id, select)
File "/usr/bin/get_yt_video.py", line 223, in get_filename
m = re.search(r"^\s*yt\.playerConfig\s*=\s*(.*);\s*$",script.text,re.M)
File "/usr/lib64/python2.7/re.py", line 142, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or buffer

Report

C

panzi

5 years ago

Ok, is it fixed in 1.11b?

Report

dglent

5 years ago

Thanks, yes it is fixed exept for the mp4 format:

Traceback (most recent call last):
File "/usr/bin/get_yt_video.py", line 506, in main
file_name, vid_url = get_filename(save_dir, video_id, select)
File "/usr/bin/get_yt_video.py", line 272, in get_filename
{"name":name, "options": "\n".join("<li><b>%s:</b> %s</li>" % (key, select[key]) for key in sorted(select))})
ValueError: <p>Video "Say Say Say by Paul McCartney and Michael Jackson by GiraldiMedia" does not support given options:</p><ul><li><b>itag:</b> 22</li></ul>

I tried with other videos too, same result.

Report

C

panzi

5 years ago

(There's no reply button on your other post.)

It's because there is no version of this video with itag 22 (mp4 720p). There is only one with itag 18 (mp4 360p). Because there is no way to dynamically generate the menu of a user script I just list some common ones, that actually might not be supported by every video.

Use my user script (linked in the description above) to get a nice download menu inside the YouTube interface that only presents you with the actually supported options. If your browser supports user scripts, that is. (They are also called greasemonkey scripts sometimes.)

If your browser does not support users scripts, it might be possible to turn it into a bookmarklet.

Report

dglent

5 years ago

It is ok for me with the right click menu.



For the userscript, i dont know how to adapt to konqueror.
I found this link http://blog.ssokolow.com/archives/2007/01/30/konqueror-with-bookmarklets/
i follow the instructions but realy say i did nt have any result and the userscript above i dont know where to add it in the bookmarklets of konqueror.

Report

C

panzi

5 years ago

Apparently crappy Konqueror does not support bookmarklets built-in. You have to install the "Minitools" plugin (usually distributions have it in their package system) for that:
http://priyadi.net/archives/2004/11/04/using-bookmarklet-in-konqueror/
Then simply copy the whole script starting after "user strict"; and paste it in the location filed of the minitools bookmark editor. Add javascript: in front and void(0) at the end of the script.

Report

dglent

6 years ago

I'd like to share the rpm that i did for Mageia

http://glenbox.free.fr/rpm/mga1/noarch/youtube-servicemenu-kde4-1.10a-1mgr1.noarch.rpm

Report

dglent

5 years ago

the new version
http://www.mageia-gr.org/rpm/1/noarch/kde-youtube-servicemenu-1.11a-1mgr1.noarch.rpm

Report

rangerGR

6 years ago

In order to make the popup menu show up in konqueor, I had to edit the desktop file and add

Quote:Type=Service
MimeType=application/octet-stream;
X-KDE-ServiceTypes=KonqPopupMenu/Plugin

under [Desktop Entry]

Report

rangerGR

6 years ago

also, get_yt_video.py doesnt work with python 3

Quote: $ get_yt_video.py
File "/usr/bin/get_yt_video.py", line 347
except Exception, e:
^
SyntaxError: invalid syntax

Report

C

panzi

6 years ago

Yeah these lines get added by mkrpm.py when you build the KDE 4 rpm or when installing using install-kde4.sh. I guess I can remove KDE 3 support now and include them per default.

Also I never tried to run the script using Python 3. Under most (all?) distributions Python 2 is still the standard.

Report

rangerGR

6 years ago

I made a custom package for arch linux using a PKGBUILD script, so i didn't use mkrpm.py or install-kde4.sh, that's why I had to add these lines manually.

Arch linux uses python 3 by default, so I had to change
#!/usr/bin/env python
to
#!/usr/bin/env python2
in order to make it work.

Report

dglent

6 years ago

i did a translation for the greek language
http://glenbox.free.fr/files/youtube-servicemenu/el.po

but i added manualy the file in: /usr/share/get_yt_video/el/LC_MESSAGES/get_yt_video.mo
and i have the messages always in english

Report

dglent

6 years ago

i forgot the desktop file !

http://glenbox.free.fr/files/youtube-servicemenu/get_yt_video.desktop

it is ok now

Report

C

panzi

6 years ago

Thanks! I'll add your translation.

Report

5 years ago

version 1.12a:
FIX: encoding problems

version 1.12:
NEW: chose format from menu with --format=ask.
NEW: --list option for Python script.
FIX: typos that made the script crash

version 1.11b:
FIX: Crash introduced in last version.

version 1.11a:
Updated greek translation. Thanks to Dimitrios Glentadakis.

version 1.11:
FIX: Extraction of video information. Now a different data extraction strategy
reading the flashvars of embed is used. Hopefully this is more stable.

version 1.10a:
ADD: Greek translation, thanks to Dimitrios Glentadakis (dglent)

version 1.10:
FIX: Extraction of video information. Now a different data extraction strategy
reading the flashvars of embed is used. Hopefully this is more stable.
DEP: New dependency to lxml: http://lxml.de/
NEW: Added video format 38: High Definition 3072p (mp4)

For more see:
http://bitbucket.org/panzi/youtube-service-menu/src/tip/Changelog

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
1.12a
updated May 04 2012
added Jun 24 2006
downloads today
0
page views today 16