Yuan Yijun (bbbush) wrote,
Yuan Yijun
bbbush

veryab (天威在线-威雅宽频影院) in fedora + firefox

前一个是 GreaseMonkey,后一个是 rtsp handler,都借助了 firebugs,谢谢华华帮我。不想做更多了,凑乎用就行。


// ==UserScript==
// @name           increase-height-of-iframe-for-veryab
// @namespace      veryab
// @description    increase height of iframe for veryab, because its
size is too restricted
// @include        http://www.veryab.com/
// ==/UserScript==

//addNameById("moviedetail");
resizeIFrame2("moviedetail", 1000);
resizeIFrame2("movieimglist", 1000);

function addNameById(id)
{
	var element = document.getElementById(id);
	element.setAttribute("name", id);
}

function resizeIFrame(name)
{
	// not working
	var iframe = window.frames[name];
	if(iframe == null) return;

	var body = iframe.document.body;
	iframe.style.height = getDocumentHeight(body);
}

function resizeIFrame2(id, defheight) {
	// default param
	if(!defheight) defheight = 1000;

	var iframe = document.getElementById(id);
	if(iframe == null) return;

	var body = iframe.contentWindow.document.body;
	var height = getDocumentHeight(body);
	iframe.height = iframe.style.height = (height)? height : defheight;
}

function getDocumentHeight(body)
{
	return body.scrollHeight + (body.offsetHeight - body.clientHeight);
}





#!/usr/bin/perl
use strict;
use warnings;

&play_veryab if @ARGV != 0;

sub play_veryab{
	my @url = &get_url_from_veryab;
	#&prompt_url(@url);
	&play_with_realplay(@url);
	#&play_with_mplayer(@url);
	#&play_with_veryab_player(@url);
}

sub get_url_from_veryab{
	foreach(@ARGV){
		s/rtsp/http/;
		s/:\d+/:100/;
	}
	@ARGV;
}

sub prompt_url{
	system "zenity --info --text 'Url is: @_'";
}

sub play_with_realplay{
	exec "padsp realplay '@_'";
}

sub play_with_mplayer{
	exec "mplayer '@_'";
}

sub play_with_veryab_player{
	exec "aoss ~/.wine/drive_c/Program\\
Files/Novasoft/vodplayer/VODPlayer.exe '@_'";
}

#original code is here.
=pod
my $url = shift || die "no input";
$url =~ s/rtsp/http/;
$url =~ s/:\d+/:100/;
exec "realplay $url";
=cut




http://211.148.197.228:100/电影63/电影/料理鼠王/料理鼠王.rmvb
http://211.148.197.235:100/电影116/动漫/高达00/1.rmvb
http://211.148.197.227:100/电影56/电影/教父1/教父1.rmvb
http://211.148.197.229:100/电影27/电影/教父2/教父2.rmvb
http://211.148.197.229:100/电影27/电影/教父3/教父3.rmvb
http://211.148.197.231:100/电影111/连续剧/金婚/50.rmvb
http://211.148.197.233:100/电影120/连续剧/超能英雄第2季/1.rmvb
http://211.148.197.226:100/电影01/连续剧/康熙王朝/50.rm
http://211.148.197.230:100/电影31/动漫/学园乌托邦学美向前冲/10.rmvb
http://211.148.197.226:100/电影29/电影/谍影重重/谍影重重.rmvb
http://211.148.197.226:100/电影29/电影/谍影重重2/谍影重重2.rmvb
http://211.148.197.230:100/电影73/连续剧/英雄/1.rmvb
http://211.148.197.230:100/电影18/连续剧/高达1-50/01.rm
http://211.148.197.228:100/电影57/动漫/史上最强弟子兼一/50.rmvb
http://211.148.197.228:100/电影63/电影/非法招标/非法招标.rmvb
http://211.148.197.235:100/电影37/动漫/新心跳回忆/25.rmvb
http://211.148.197.230:100/电影31/动漫/学园乌托邦学美向前冲/10.rmvb
http://211.148.197.235:100/电影46/动漫/武装炼金/26.rmvb
http://211.148.197.226:100/电影32/动漫/反叛的鲁路修/24-25.rmvb
http://211.148.197.229:100/电影10/连续剧/秀逗魔导士I/26.rm
http://211.148.197.229:100/电影05/连续剧/天空战记/38.rm
http://211.148.197.234:100/电影11/连续剧/翼之年代记/26.rm
http://211.148.197.232:100/电影72/连续剧/IsPure/7.rm
http://211.148.197.226:100/电影34/动漫/鬼眼狂刀/26.rm
http://211.148.197.227:100/电影44/动漫/一骑当千/14.rmvb
http://211.148.197.234:100/电影30/连续剧/闪灵二人组/49.rm
http://211.148.197.226:100/电影34/动漫/全职猎人/62.rmvb
http://211.148.197.229:100/电影05/连续剧/甲贺忍法帖/24.rm
http://211.148.197.232:100/电影36/动漫/全金属狂潮I/24.rm
http://211.148.197.228:100/电影63/动漫/全金属狂潮II/13.rm
http://211.148.197.230:100/电影71/动漫/全金属狂潮3/13.rm





update 20071227
因为 firefox 3 暂时不支持 GreaseMonkey,而且对页面好像有更高的要求,因此 javascript 没法执行了…… 用 zenity 搭配 shell 做了一个脚本,输入电影编号或者地址就可以播放了。

#!/bin/sh
READFROMFILE=
DEBUG=$READFROMFILE

function read_input
{
    while :; do
## read a number first
	INPUT=$(zenity --entry --text="输入电影编号" --entry-text="输入电影编号或网页地址")
	echo $INPUT > /dev/stderr
	if test "x$INPUT" == "x"; then
	    exit
	fi

## For a URL, get the number.
## For a number, check for range. 
	if [[ "$INPUT" =~ "^http.*=([0-9]+)$" ]]; then
	    INPUT=${BASH_REMATCH[1]}
	    echo $INPUT > /dev/stderr
	fi

	if test "x$INPUT" != "x"; then
	    break
	fi
    done
}

function read_input_stock
{
    INPUT=27672
}

function get_detail 
{
    DETAILURL=http://www.veryab.com/Movie/public/movie_detail.jsp
    CONTENT=`wget -c $DETAILURL?id=$INPUT -O - | dos2unix | iconv -f gbk -t utf8 | tee $INPUT.txt`
    echo $CONTENT > /dev/stderr
}

function get_detail_from_file
{
    CONTENT=`cat $INPUT.txt`
    echo $CONTENT > /dev/stderr
}

function parse_detail
{
    echo parse detail > /dev/stderr
    if [[ "$CONTENT" =~ ".*<span class=\"table_tx07\"><font color=\"050505\">(.*)</font></span>.*<SELECT[^>]*>(.*)</SELECT>.*<span id =\"detail\" *>(.*)(</span>)?" ]]; then
	TITLE=${BASH_REMATCH[1]}
	echo $TITLE > /dev/stderr
	OPTIONS=${BASH_REMATCH[2]}
	echo $OPTIONS > /dev/stderr
	DETAIL=${BASH_REMATCH[3]}
	echo $DETAIL > /dev/stderr
    else
	echo "error page???" > /dev/stderr
	exit
    fi
}

function show_detail
{
    QUIT=$(zenity --info --text="`echo "$DETAIL" | sed -e 's/&nbsp;//g' | sed -e 's/<BR>//g'`")
}

function get_list
{
#if [[ $OPTIONS =~ "(<OPTION[^<]*</OPTION>)" ]]; then
#	OPTIONS=("${BASH_REMATCH[@]}")
#fi

#for i in `seq ${#OPTIONS[@]}`; do
#	OPTION="${OPTIONS[$i]}"
#	if [[ $OPTION =~ "<OPTION VALUE='([0-9]+)'[^>]*>(.*)</OPTION>" ]]; then
#		LIST=("${LIST[@]}" "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}")
#	fi
#done

    LIST=($(echo $OPTIONS |sed -e  "s,<OPTION VALUE='\([^']*\)'[^>]*>\([^<]*\)</OPTION>,\1 \2,g"))
    echo "${LIST[@]}" > /dev/stderr
}

function get_selection
{
## prompt for information, as well as list of videos
    SELECTION=$(zenity --list --text="$TITLE" --column="id2" --column="选择" --hide-column=1 --multiple "${LIST[@]}")
    echo $SELECTION > /dev/stderr
    if test "x$SELECTION" == "x"; then
	exit
    fi
}

function do_play_selection
{
## call read_rtsp
    CONTENT=`wget -c $PLAYURL -O - | dos2unix | iconv -f gbk -t utf8 `
    echo $CONTENT > /dev/stderr
    if [[ $CONTENT =~ "(rtsp[^']*)'" ]]; then
	echo ${BASH_REMATCH[1]} > /dev/stderr
	exec ~/.local/bin/read_rtsp ${BASH_REMATCH[1]}
    fi
}

function play_selection
{
    PLAYACTIONURL=http://www.veryab.com/Movie/player/playAction.do
    for ID2 in $SELECTION; do
	PLAYURL="$PLAYACTIONURL?id=$INPUT&id2=$ID2"
	do_play_selection 
    done
## if we were wrong, still can play at least one
    if [ "x$SELECTION" == "x" ]; then
	PLAYURL=$PLAYACTIONURL?id=$INPUT
	do_play_selection
    fi
}

if [ "x$DEBUG" != "x" ] || [ "x$READFROMFILE" != "x" ]; then
    read_input_stock
    get_detail_from_file
else
    read_input
    get_detail
fi
parse_detail
#show_detail
get_list
if [ "x$DEBUG" != "x" ]; then
    exit
fi

## only prompt for selection when there are more than 1 videos
if [ ${#LIST[@]} == 2 ]; then
	    SELECTION=${LIST[0]}
	    play_selection 
elif [ ${#LIST[@]} == 0 ]; then
	    echo "no videos found??" > /dev/stderr
	    SELECTION=()
	    play_selection
else
    while :; do
	get_selection
	play_selection
    done
fi

Tags: fedora
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments