dschroeter
Still Fresh
- Joined
 - Apr 25, 2009
 
- Messages
 - 71
 
- Age
 - 44
 
This will run for sure, if you have the correct codecs. It uses Qt 4.5 so "porting" it would take, like, 30 seconds.dschroeter said:There is a project called minitube that aims to be a standalone youtube viewer with no flash required. Source code is provided, but I'm not a dev so no idea if this could be ported. Any takers?
video-dl.sh yt AMZsJIyv4ys
	video-dl.sh yt AMZsJIyv4ys wget -O 'Craig’s Pandora.mp4'
	!/bin/bash
# (c) 2009 Vitel GPL v3
if [ $# -lt 2 ]
then
    echo "Usage: $0 site video_id [handler [options]]"
    exit
fi
SITE=$1
shift
VIDEO_ID=$1
shift
if [ -z $1 ]
then
    HANDLER=mplayer
else
    HANDLER=$1
    shift
fi
case "$SITE" in
    yt|youtube|youtube.com)
        # null - fvl, 18 - mp4, 22 - hd
        FMT=18
        TOKEN=$(wget -q -O - "http://www.youtube.com/get_video_info?&video_id=$VIDEO_ID" | \
            sed -e 's/.*&token=([^&]*).*/\1/' | \
            perl -pe "s/%(..)/chr(hex(\$1))/eg" \
        )
        DL_URL="http://www.youtube.com/get_video?video_id=$VIDEO_ID&fmt=$FMT&t=$TOKEN"
        ;;
    vm|vimeo|vimeo.com)
        VIDEO_XML=$(wget -q -O - "http://www.vimeo.com/moogaloop/load/clip:$VIDEO_ID")
        SIGNATURE=$(echo $VIDEO_XML | sed -e 's/^.*<request_signature>([^<]*)<.*$/\1/g')
        SIGNATURE_EXPIRES=$(echo $VIDEO_XML | sed -e 's/^.*<request_signature_expires>([^<]*)<.*$/\1/g')
        DL_URL="http://www.vimeo.com/moogaloop/play/clip:$VIDEO_ID/$SIGNATURE/$SIGNATURE_EXPIRES/?q=sd"
        ;;
    *)
        echo "Unknown site '$SITE'"
        exit 1;
        ;;
esac
echo $DL_URL | xargs $HANDLER "$@"
	// ==UserScript==
// @name           Youtube download link
// @namespace      www.yotube.com
// @description    Add download link to youtube
// @include        http://www.youtube.com/watch?v=*
// ==/UserScript==
// Search within the script elements for the
// "video_id" and "t" fields
var vid = "";
var t = "";
var x=document.getElementsByTagName("script");
for(i=0;i<x.length;i++)
{
	var temp = String(x[i].text);
	var vid_match = /"video_id": "([^"]+)"/.exec(temp);
	var t_match = /"t": "([^"]+)"/.exec(temp);
	if(vid_match != null)
		vid = vid_match[1];
	if(t_match != null)
		t = t_match[1];
}
// Create the anchor elements for download links
// HQ
var anchorh = document.createElement("a");
anchorh.setAttribute("id","hq-download-link");
anchorh.innerHTML = "Download HQ";
anchorh.href = "http://www.youtube.com/get_video?t=" + t + "&video_id=" + vid + "&fmt=22";
// LQ
var anchorl = document.createElement("a");
anchorl.setAttribute("id","lq-download-link");
anchorl.innerHTML = "Download LQ";
anchorl.href = "http://www.youtube.com/get_video?t=" + t + "&video_id=" + vid + "&fmt=18";
// Text node to put a space between links
var text_space = document.createTextNode(" ");
// Add both anchor elements bellow video title
var div = document.getElementById("watch-vid-title");
div.appendChild(anchorh);
div.appendChild(text_space);
div.appendChild(anchorl);
	Hey, why are you scanning all of the scripts on the whole page for the video ID instead of using "document.location.href.split(..."?Yoyobuae said:I prefer downloading the video file first (and limit download speed, I dislike it when people nuke the net connection while youtubing).
I'm using a Greasemonkey (firefox add-on) javascript to add download links in youtube video pages:
[snip]
Follows the same idea as the one by Vitel (only youtube support though).
	