You are not logged in.
I just wrote up a little script to play flash videos automatically. I have only tested this with youtube videos.
Things needed to be implemented:
- Pausing or muting the current flash video so you can watch the video in MPlayer without having to pause the Flash video manually
- Have MPlayer close when the user goes to a different page
- Support for multiple videos
Do what you want with it. I simply run the script in xterm in a different tab on Awesome and have it in the background.
#!/bin/sh
while [ 1 ]; do # Endless Loop
if [ -f /tmp/Flash* ] # Check if flash video exists
then
echo "Waiting to start video..." #Count Down
for (( c=3; c>0; c-- ))
do
echo "Starting video in $c seconds"
sleep 1
done
mplayer /tmp/Flash* # Play video
else
sleep 2 # Put in to lower CPU consumption
fi
done
Really, not impressive, but it will have to do for now
To change the countdown time, change the value of $c in the for loop (seconds)
NOTE: If /bin/sh is not symlinked to your shell, please change the script, replacing sh with your shell.
Last edited by cesura (2010-07-03 03:10:35)
Offline
I like the general idea of this and it does have potential as a replacement to flash players. Most of which I do not like.
The software required Windows XP or better, so I installed archlinux.
Offline
I like the general idea of this and it does have potential as a replacement to flash players. Most of which I do not like.
As of now, it requires flash simply to stream the video to the /tmp directory, MPlayer just makes it extremely faster. A couple of more mods and it could become something useful for everybody
Offline
The shebang should be #!/bin/bash. sh doesn't support C-like for loops, it's just silly bash that happily uses bash-specific functionality even when invoked in compatibility mode (sh)
Offline
Give this a youtube url, and it will play it straight
in mplayer - no need for flash, no need to buffer the
whole vid, no need to play it from /tmp;
All props to zibri.
#!/usr/bin/perl
use LWP::Simple;
my $player = 'mplayer';
my $url = shift or die("Needs argument");
my $body = get($url);
my($t) = $body =~ /"t":\s*"(.+?)"/is;
my($video_id) = $body =~ /"video_id":\s*"(.+?)"/is;
my $real_url = "http://www.youtube.com/get_video?video_id=$video_id&t=$t";
print "$real_url\n";
system("$player '$real_url'");
exit 0;
Offline
Give this a youtube url, and it will play it straight
in mplayer - no need for flash, no need to buffer the
whole vid, no need to play it from /tmp;
All props to zibri.#!/usr/bin/perl use LWP::Simple; my $player = 'mplayer'; my $url = shift or die("Needs argument"); my $body = get($url); my($t) = $body =~ /"t":\s*"(.+?)"/is; my($video_id) = $body =~ /"video_id":\s*"(.+?)"/is; my $real_url = "http://www.youtube.com/get_video?video_id=$video_id&t=$t"; print "$real_url\n"; system("$player '$real_url'"); exit 0;
Cool, except it doesn't run when you click on a video, or does it?
Offline
Cool, except it doesn't run when you click on a video, or does it?
It doesn't but it should be easy to make a greasmonkey/chrome userscript to do that.
Offline
itsbrad212 wrote:Cool, except it doesn't run when you click on a video, or does it?
It doesn't but it should be easy to make a greasmonkey/chrome userscript to do that.
Greasemonkey would probably be better as I don't think there is a plug-in for Firefox for chrome userscripts, and I do believe that greasemonkey scripts can be run on firefox AND chromium.
EDIT:
The shebang should be #!/bin/bash. sh doesn't support C-like for loops, it's just silly bash that happily uses bash-specific functionality even when invoked in compatibility mode (sh)
It all works fine in zsh...
Last edited by cesura (2010-05-01 17:10:40)
Offline
I use this on Chromium:
http://userscripts.org/scripts/show/50771
Makes Youtube tolerable on my 7" EeePC with a Celeron.
Offline
I use this on Chromium:
http://userscripts.org/scripts/show/50771Makes Youtube tolerable on my 7" EeePC with a Celeron.
I tried that script with greasemonky before, but there were problems, which is what caused me to write this
Last edited by cesura (2010-05-02 04:29:30)
Offline
thnx for that,indeed it is necessery for flashplugin-crap!
Offline
Im trying to use dmz's script and i get this.
┌─[yamifrankc]──(~)
└─╼ perl youtube.pl http://www.youtube.com/watch?v=5JOpQD2VNaE&playnext_from=TL&videos=pIcVAkdz0qs&feature=grec_index
zsh: parse error near `&
Why?
Thanks and greetings.
Offline
Because you're not escaping bad chars in the url.
perl youtube.pl 'http...'
Offline
Ah, thanks.
Works like a charmm because i do not see many video like having an script running endless .
Thanks and greetings.
Offline
Follows the same idea of dmz's perl script:
mplayer $(youtube-dl -g $URL)
Offline
Follows the same idea of dmz's perl script:
mplayer $(youtube-dl -g $URL)
That is much smaller
Problem with that is it doesn't start automatically when you visit a youtube page, and it requires yet another program.
Offline
[
EDIT:The shebang should be #!/bin/bash. sh doesn't support C-like for loops, it's just silly bash that happily uses bash-specific functionality even when invoked in compatibility mode (sh)
It all works fine in zsh...
Yes, I didn't claim otherwise. It doesn't in sh, however. Please read my post again.
Offline
Not to hijack this thread, but it looks like
mplayer -cache 8192 -cache-min 10 $(youtube-dl -bg $url)
works fairly well... (as long as the cache doesn't run out.) Thanks jakobm!
As for the automatic starting... I'll see if I can start this from a keypress in Firefox (I think it's quite doable.)
Offline
itsbrad212 wrote:[
EDIT:The shebang should be #!/bin/bash. sh doesn't support C-like for loops, it's just silly bash that happily uses bash-specific functionality even when invoked in compatibility mode (sh)
It all works fine in zsh...
Yes, I didn't claim otherwise. It doesn't in sh, however. Please read my post again.
I was simply saying that it has worked (for me) in bash and zsh. It could work in many more. And I thought many people had /bin/sh a symlink to their shell. I'll adjust the first post accordingly.
Last edited by cesura (2010-07-03 03:09:17)
Offline
For a really nice youtube experience I recommend minitube for the gui people and youtube-viewer (AUR) for the cli people :-)
Offline
For a really nice youtube experience I recommend minitube for the gui people and youtube-viewer (AUR) for the cli people :-)
youtube-viewer was very nice. The code, however, was not... I'll fix that.
Offline
youtube-viewer was very nice. The code, however, was not... I'll fix that.
Nice :-)
Offline
youtube-viewer will simply close if you let it play a video with 3-digit numbers....
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
NVM - mod, erase.
Last edited by archman-cro (2010-08-27 09:09:58)
Offline
Deleted.
Last edited by diegoviola (2023-04-17 22:28:39)
Offline