diff options
author | Christopher Vollick <psycotica0@gmail.com> | 2013-03-09 17:39:52 -0500 |
---|---|---|
committer | Christopher Vollick <psycotica0@gmail.com> | 2013-03-09 17:45:53 -0500 |
commit | 418c1c0d316424fe8a4f186f030db09988725c48 (patch) | |
tree | 7b86fd957d6d9b5717019aa3f0ea321dc3e25e8c | |
parent | e99838b60187b54d28175af04948bfb97c480338 (diff) | |
download | get-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.pm | 2 |
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 =~ /&video_id=([^&]+)&/) { $video_id = $1; } else { |