aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Vollick <psycotica0@gmail.com>2013-03-09 17:39:52 -0500
committerChristopher Vollick <psycotica0@gmail.com>2013-03-09 17:45:53 -0500
commit418c1c0d316424fe8a4f186f030db09988725c48 (patch)
tree7b86fd957d6d9b5717019aa3f0ea321dc3e25e8c
parente99838b60187b54d28175af04948bfb97c480338 (diff)
downloadget-flash-videos-418c1c0d316424fe8a4f186f030db09988725c48.tar.gz
Fixed YouTube Link Regexp
When the v= argument, which contains the video ID, is at the end and a link is posted with a timestamp the url becomes v=fhuuefurfe#t=302s or something. The regexp stopped at '&' but not '#', so it was fetching an invalid video ID. I was expected the rel="canonical" thing to fix that, but it turns out that while curl gets the real page with its user agent, we attempt to mimic Mozilla on Windows. Whatever Mechanize has for this, though, Google deems too old and instead delivers a reduced page that doesn't have rel="canonical" thing, among other things. This confused the HELL out of me, since curl is my go-to debugging tool.
-rw-r--r--lib/FlashVideo/Site/Youtube.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/FlashVideo/Site/Youtube.pm b/lib/FlashVideo/Site/Youtube.pm
index 0abcf15..09b2f50 100644
--- a/lib/FlashVideo/Site/Youtube.pm
+++ b/lib/FlashVideo/Site/Youtube.pm
@@ -68,7 +68,7 @@ sub find_video {
my $video_id;
if ($browser->content =~ /(?:var pageVideoId =|(?:CFG_)?VIDEO_ID'?\s*:)\s*'(.+?)'/
|| $browser->content =~ /[&?]video_id=([^&"]+)/
- || $embed_url =~ /v=([^&]+)/
+ || $embed_url =~ /v=([^&#]+)/
|| $browser->content =~ /&amp;video_id=([^&]+)&amp;/) {
$video_id = $1;
} else {