From 5185d100c0406dab1f9013e5b0e86289558225e9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 26 Sep 2009 20:46:01 -0400 Subject: [PATCH] Replaced the Yikers algorithm with a simpler one (that actually works). Removed the obsolete Yikers tests and fixtures. --- src/websites/yikers.rb | 41 +-- .../video_college_cafeteria_strip_off.html | 327 ------------------ .../video_college_cafeteria_strip_off.xml | 274 --------------- test/yikers_test.rb | 35 -- 4 files changed, 11 insertions(+), 666 deletions(-) delete mode 100644 test/fixtures/yikers/video_college_cafeteria_strip_off.html delete mode 100644 test/fixtures/yikers/video_college_cafeteria_strip_off.xml diff --git a/src/websites/yikers.rb b/src/websites/yikers.rb index bb90e3b..8cf407a 100644 --- a/src/websites/yikers.rb +++ b/src/websites/yikers.rb @@ -29,18 +29,18 @@ class Yikers < Website def get_video_url() - # First we download the page. Each page contains a flash parameter - # called 'xml' which contains the relative path to the video's XML file. - # We download their XML file (passing it the video id as a side effect), - # and that contains the URL of the video file we want. - page_data = get_page_data(@url) - xml_path = self.parse_xml_path(page_data) - - # The XML path parameter doesn't contain a host name. - xml_url = "http://#{self.server}#{xml_path}" - xml_data = get_page_data(xml_url) + # The video URL is usually just a fixed location, with the file + # name from the page URL slightly modified. For example, + # + # http://www.yikers.com/video_the_best_rapper_in_the_world.html + # + # gets mapped to, + # + # http://cdn.yikers.com/flv/flash8/yikers_the_best_rapper_in_the_world.flv + # + file_name = get_video_filename().sub('video_', 'yikers_') - video_url = parse_video_url(xml_data) + video_url = "http://cdn.yikers.com/flv/flash8/#{file_name}" return video_url end @@ -61,24 +61,5 @@ class Yikers < Website return (filename + '.flv') end - - protected; - - def parse_video_url(data) - video_url_regex = /http:\/\/(cdn\.)?yikers\.com\/([[:alnum:]_\/]+)\.flv/ - matches = video_url_regex.match(data) - video_url = matches[0] if not matches.nil? - - return video_url - end - - - def parse_xml_path(data) - xml_path_regex = /addVariable\(\'xml\', \'(.*?)\'\)/ - matches = xml_path_regex.match(data) - xml_path = matches[1] if not (matches.nil? || matches.length < 2) - - return xml_path - end end diff --git a/test/fixtures/yikers/video_college_cafeteria_strip_off.html b/test/fixtures/yikers/video_college_cafeteria_strip_off.html deleted file mode 100644 index 6498862..0000000 --- a/test/fixtures/yikers/video_college_cafeteria_strip_off.html +++ /dev/null @@ -1,327 +0,0 @@ - - -College Cafeteria Strip Off - - - - - - - - - - - - - - - - - - - - - - - -
- SlideShows | Upload | Groups | Live Shows -
- - - - - -
- Funny Videos, Pictures, Jokes, and Fun Humor - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   - -

College Cafeteria Strip Off

- - - - - - -
- - -
- -
- - -
- -
<< PreviousTrouble watching? Contact usNext >>
- - - - - - -
- -

Similar Media

- -
Sexy drunk girl c...Espn profanityDrunks take out c...Frisky sea otter
-

- - - - - -
- - - -

User Comments

- - - - - - - -
- - Posted by: bosshonkey on May 10, 2007 @ 05:03:26 am

- and this is our future? great....wtf are these 'students' learning? -Wonder if their parents like paying for them to strip in school. xxxxing -retards
-

-

- - - - - -
- - Posted by: devin on May 10, 2007 @ 08:41:43 am

- I want to go to school there.
-

-

- - - - - -
- - Posted by: disbelief on May 10, 2007 @ 09:20:19 am

- i agree... some people need to be hit in the face with a brick.
-

-

- - - - - -
- - Posted by: bosshonkey on May 10, 2007 @ 09:49:42 am

- or two....
-

-

- - - - - -
- - Posted by: quick flex on May 10, 2007 @ 03:37:06 pm

- Yeah, what school is this? I'd also like to enroll.
-

-

- - - - - -
- - Posted by: obscura on May 10, 2007 @ 10:15:41 pm

- Silkeborg Highschool in Denmark
-

-

- - - - - - -
Post Comment:
-

Want to post a comment? Register for a free account or login to your existing account.

- -

  - - - -

Today's Top Sites

Macho Video
Hot Video Links
Kontraband
Ownage Videos
Flurl Video Search
Funny Crazy Videos
Hot Videos
MojoFlix
Unique Peek
Street Fight Videos
Free Online Games
FileCabi.net
Kill Some Time
Favorite Vids n Pics
Hot Vids
Play Online Games
Whats Your IQ?
Add Your Link
More Cool Sites

- - - - -

  - - Register for free | Login

- - - -

-
- - - - - - - -
Cool Clips
A cat with two faces.
Best wedding first dance ever.
How to get with two girls.
Student tries to poison teacher.
-
- -

- -

Must See LIVE Streaming

- - -

More Cool Videos

-

-

Trade traffic? Sign up and start sending traffic. We will send 1:1 back via the random rotation plugs above. The more hits you send the more hits you will get back. Sign up if you are interested in trading permanent plug. - -

  
-
-
DMCA | Privacy | Terms of Service | Advertise | Trade Traffic | Contact | Forums | RSS

Celebrity Videos | Video Search Engine | Celebrity Gossip Videos | Celebrity News Videos | Hollywood Gossip Videos | Hollywood Celeb Videos | Election 2008 Videos

NBA Basketball Videos | MLB Baseball Videos | Sexy Celebrity Videos | Humor Comedy Videos

Copyright © 2007 Yikers.com. All Rights Reserved.

- - - - - - - - - diff --git a/test/fixtures/yikers/video_college_cafeteria_strip_off.xml b/test/fixtures/yikers/video_college_cafeteria_strip_off.xml deleted file mode 100644 index dd4cf6d..0000000 --- a/test/fixtures/yikers/video_college_cafeteria_strip_off.xml +++ /dev/null @@ -1,274 +0,0 @@ - - - - true - - - - - - - - - true - - bottom - false - false - - - 0 - 0 - - - - false - - true - 10000 - - - 0 - 392 - - - - false - - true - 10000 - - - 28 - 429 - - - - - - - 20 - 45549FE81D8B42E9A688CAF4BD24AA22 - 20 - 45549FE81D8B42E9A688CAF4BD24AA22 - 20 - 45549FE81D8B42E9A688CAF4BD24AA22 - - - /flash/lu_postroll_001.swf - false - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/yikers_test.rb b/test/yikers_test.rb index 1c9548d..7bb8150 100644 --- a/test/yikers_test.rb +++ b/test/yikers_test.rb @@ -50,44 +50,9 @@ class YikersTest < Test::Unit::TestCase end - def test_parse_xml_path - yikers = Yikers.new(nil) - - page_data = nil - - File.open('test/fixtures/yikers/video_college_cafeteria_strip_off.html') do |f| - page_data = f.read - end - - test_result = yikers.send('parse_xml_path', page_data) - assert_equal('/flash/play_flash_xml.php?cid=11798', test_result) - end - - - def test_parse_video_url - yikers = Yikers.new(nil) - - page_data = nil - - File.open('test/fixtures/yikers/video_college_cafeteria_strip_off.xml') do |f| - page_data = f.read - end - - test_result = yikers.send('parse_video_url', page_data) - assert_equal('http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flv', test_result) - end - - def test_get_video_filename yikers = Yikers.new('http://www.yikers.com/video_college_cafeteria_strip_off.html') assert_equal('video_college_cafeteria_strip_off.flv', yikers.get_video_filename()) end - - - def test_uri_query_works_on_yikers_urls - uri = URI.parse('http://www.yikers.com/flash/play_flash_xml.php?cid=11798') - http_path = uri.path + '?' + uri.query - assert_equal('/flash/play_flash_xml.php?cid=11798', http_path) - end end -- 2.44.2