diff options
author | Markos Chandras <hwoarang@gentoo.org> | 2012-02-29 21:33:32 +0000 |
---|---|---|
committer | Markos Chandras <hwoarang@gentoo.org> | 2012-02-29 21:33:32 +0000 |
commit | acada49809cab92a9c3223ecb22a757d993289c3 (patch) | |
tree | bc8659258fd60c78692ad9ea84fdbef27cde7441 /media-video/get_flash_videos | |
parent | Fixed the Header for ChangeLog (diff) | |
download | gentoo-2-acada49809cab92a9c3223ecb22a757d993289c3.tar.gz gentoo-2-acada49809cab92a9c3223ecb22a757d993289c3.tar.bz2 gentoo-2-acada49809cab92a9c3223ecb22a757d993289c3.zip |
Apply youtube fix from upstream. Bug #405761. Thanks to Peter Fox <gentoo@roestock.demon.co.uk>
(Portage version: 2.2.0_alpha88/cvs/Linux x86_64)
Diffstat (limited to 'media-video/get_flash_videos')
3 files changed, 162 insertions, 2 deletions
diff --git a/media-video/get_flash_videos/ChangeLog b/media-video/get_flash_videos/ChangeLog index 086efc66e18f..b8963166a421 100644 --- a/media-video/get_flash_videos/ChangeLog +++ b/media-video/get_flash_videos/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for media-video/get_flash_videos -# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/get_flash_videos/ChangeLog,v 1.11 2011/07/29 22:16:43 zmedico Exp $ +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/media-video/get_flash_videos/ChangeLog,v 1.12 2012/02/29 21:33:32 hwoarang Exp $ + +*get_flash_videos-1.24-r1 (29 Feb 2012) + + 29 Feb 2012; Markos Chandras <hwoarang@gentoo.org> + +files/get_flash_videos-youtubefix.patch, +get_flash_videos-1.24-r1.ebuild: + Apply youtube fix from upstream. Bug #405761. Thanks to Peter Fox + <gentoo@roestock.demon.co.uk> 29 Jul 2011; Zac Medico <zmedico@gentoo.org> get_flash_videos-1.24.ebuild: Add ~x86-linux keyword. diff --git a/media-video/get_flash_videos/files/get_flash_videos-youtubefix.patch b/media-video/get_flash_videos/files/get_flash_videos-youtubefix.patch new file mode 100644 index 000000000000..0bca2bbd450d --- /dev/null +++ b/media-video/get_flash_videos/files/get_flash_videos-youtubefix.patch @@ -0,0 +1,100 @@ +https://bugs.gentoo.org/show_bug.cgi?id=405761 + +https://github.com/richcollins/get-flash-videos/commit/27e0f1d214e291debfd567b1652908d0ef6b79d1#lib/FlashVideo/Site + +--- lib/FlashVideo/Site/Youtube.pm~ 2010-11-30 14:34:17.000000000 +0000 ++++ lib/FlashVideo/Site/Youtube.pm 2012-02-20 23:56:35.000000000 +0000 +@@ -26,6 +26,7 @@ + if($embed_url !~ m!youtube\.com/watch!) { + $browser->get($embed_url); + if ($browser->response->header('Location') =~ m!/swf/.*video_id=([^&]+)! ++ || $browser->content =~ m!\<iframe[^\>]*src="http://www.youtube.com/embed/([^"]+)"!i + || $embed_url =~ m!/v/([-_a-z0-9]+)!i + || $browser->uri =~ m!v%3D([-_a-z0-9]+)!i) { + # We ended up on a embedded SWF or other redirect page +@@ -48,12 +49,19 @@ + # If the page contains fmt_url_map, then process this. With this, we + # don't require the 't' parameter. + if ($browser->content =~ /["']fmt_url_map["']:\s{0,3}(["'][^"']+["'])/) { +- debug "Using fmt_url_map method from page ($1)"; +- return $self->download_fmt_map($prefs, $browser, $title, {}, @{from_json $1}); ++ my $fmt_map = $1; ++ if ($fmt_map !~ /\|/) { ++ # $fmt_map is double escaped. We should unescape it here just ++ # once. Be careful not to unescape ',' in the URL. ++ $fmt_map = uri_unescape($fmt_map); ++ } ++ debug "Using fmt_url_map method from page ($fmt_map)"; ++ return $self->download_fmt_map($prefs, $browser, $title, {}, @{from_json $fmt_map}); + } + + my $video_id; + if ($browser->content =~ /(?:var pageVideoId =|(?:CFG_)?VIDEO_ID'?\s*:)\s*'(.+?)'/ ++ || $browser->content =~ /"video_id": "([^"]+)"/ + || $embed_url =~ /v=([^&]+)/) { + $video_id = $1; + } else { +@@ -125,6 +133,9 @@ + } elsif($info{fmt_url_map}) { + debug "Using fmt_url_map method from info"; + return $self->download_fmt_map($prefs, $browser, $title, \%info, $info{fmt_url_map}); ++ } elsif($info{url_encoded_fmt_stream_map}) { ++ debug "Using url_encoded_fmt_stream_map method from info"; ++ return $self->download_url_encoded_fmt_stream_map($prefs, $browser, $title, \%info, $info{url_encoded_fmt_stream_map}); + } + } + +@@ -132,6 +143,53 @@ + return download_get_video($browser, $prefs, $video_id, $title, $t); + } + ++sub download_url_encoded_fmt_stream_map { ++ my($self, $prefs, $browser, $title, $info, $fmt_map) = @_; ++ ++ my $fmt_url_map = parse_youtube_url_encoded_fmt_stream_map($fmt_map); ++ ++ if (!$title and $browser->uri->as_string =~ m'/user/.*?#') { ++ my $video_id = (split /\//, $browser->uri->fragment)[-1]; ++ ++ my %info = get_youtube_video_info($browser->clone, $video_id); ++ ++ $title = $info->{title}; ++ } ++ ++ my $preferred_quality = $prefs->quality->choose(map { $fmt_url_map->{$_->{id}} ++ ? { resolution => $_->{resolution}, url => $fmt_url_map->{$_->{id}} } ++ : () } @formats); ++ ++ $browser->allow_redirects; ++ ++ return $preferred_quality->{url}, title_to_filename($title, "mp4"); ++} ++ ++sub parse_youtube_url_encoded_fmt_stream_map { ++ my($raw_map) = @_;; ++ ++ my $map = {}; ++ ++ foreach my $params (split /,/, $raw_map) { ++ ++ my $format = ""; ++ my $url = ""; ++ ++ foreach my $pair (split /&/, $params) { ++ my ($name, $value) = split /=/, $pair; ++ if ($name eq "itag"){ ++ $format = $value; ++ } elsif ($name eq "url") { ++ $url = uri_unescape($value); ++ } ++ } ++ ++ $map->{$format} = $url; ++ } ++ ++ return $map; ++} ++ + sub download_fmt_map { + my($self, $prefs, $browser, $title, $info, $fmt_map) = @_; + diff --git a/media-video/get_flash_videos/get_flash_videos-1.24-r1.ebuild b/media-video/get_flash_videos/get_flash_videos-1.24-r1.ebuild new file mode 100644 index 000000000000..335f7a3010fe --- /dev/null +++ b/media-video/get_flash_videos/get_flash_videos-1.24-r1.ebuild @@ -0,0 +1,53 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-video/get_flash_videos/get_flash_videos-1.24-r1.ebuild,v 1.1 2012/02/29 21:33:32 hwoarang Exp $ + +EAPI=2 +inherit eutils perl-module + +MY_PN="App-${PN}" +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="Downloads videos from various Flash-based video hosting sites" +HOMEPAGE="http://code.google.com/p/get-flash-videos/" +SRC_URI="http://get-flash-videos.googlecode.com/files/${MY_P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~x86-linux" +IUSE="test" + +RDEPEND="dev-perl/WWW-Mechanize + perl-core/Module-CoreList + dev-perl/HTML-TokeParser-Simple" +DEPEND="${RDEPEND} + dev-perl/UNIVERSAL-require + test? ( media-video/rtmpdump + dev-perl/Tie-IxHash + dev-perl/XML-Simple + dev-perl/Crypt-Rijndael + dev-perl/Data-AMF + perl-core/IO-Compress )" + +SRC_TEST="do" + +S="${WORKDIR}/${MY_P}" +SRC_TEST="do" +myinst="DESTDIR=${D}" + +src_prepare() { + # 405761 + epatch "${FILESDIR}"/${PN}-youtubefix.patch + perl-module_src_prepare +} + +pkg_postinst() { + elog "Downloading videos from RTMP server requires the following packages :" + elog " media-video/rtmpdump" + elog " dev-perl/Tie-IxHash" + elog "Others optional dependencies :" + elog " dev-perl/XML-Simple" + elog " dev-perl/Crypt-Rijndael" + elog " dev-perl/Data-AMF" + elog " perl-core/IO-Compress" +} |