From 38a44e48b85532a439ee770c245caaec2a6fc769 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Wed, 17 Aug 2016 21:13:28 +0100 Subject: [PATCH 1/4] metacafe extractor: deal with family filter If you don't send this user=ffilter: false cookie, it will 301 redirect you to a page asking about it, and then the title check will fail. --- youtube_dl/extractor/metacafe.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/metacafe.py b/youtube_dl/extractor/metacafe.py index e6e7659a1..6da69f84d 100644 --- a/youtube_dl/extractor/metacafe.py +++ b/youtube_dl/extractor/metacafe.py @@ -148,8 +148,9 @@ class MetacafeIE(InfoExtractor): # AnyClip videos require the flashversion cookie so that we get the link # to the mp4 file headers = {} + headers['Cookie'] = 'user=%7B%22ffilter%22%3Afalse%7D;'; if video_id.startswith('an-'): - headers['Cookie'] = 'flashVersion=0;' + headers['Cookie'] += ' flashVersion=0;' # Retrieve video webpage to extract further information webpage = self._download_webpage(url, video_id, headers=headers) From 9d87eb84b9508b497372ee350985bb21afd5d550 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Fri, 2 Sep 2016 15:46:04 +0100 Subject: [PATCH 2/4] Add test for metacafe ffilter --- test/test_metacafe_ffilter.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/test_metacafe_ffilter.py diff --git a/test/test_metacafe_ffilter.py b/test/test_metacafe_ffilter.py new file mode 100644 index 000000000..a981f88f9 --- /dev/null +++ b/test/test_metacafe_ffilter.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +import os +import sys +import unittest +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +from test.helper import try_rm + +from youtube_dl import YoutubeDL + +class TestMetacafeFFilter(unittest.TestCase): + def test_metacafe(self): + filename = '2155630.mp4' + url = 'http://www.metacafe.com/watch/2155630/adult_art_by_david_hart_156/' + + params = { + 'skip_download': True, + 'writeinfojson': True, + 'outtmpl': '%(id)s.%(ext)s', + } + ydl = YoutubeDL(params) + ydl.add_default_info_extractors() + json_filename = os.path.splitext(filename)[0] + '.info.json' + try_rm(json_filename) + ydl.download([url]) + res = os.path.exists(json_filename) + try_rm(json_filename) + self.assertTrue(res) + + +if __name__ == '__main__': + unittest.main() From 1c70f6cb64f69151d3dd99164379e33fa4c9daa9 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sun, 4 Sep 2016 15:24:13 +0100 Subject: [PATCH 3/4] Fix tests for metacafe ffilter This reverts commit 9d87eb84b9508b497372ee350985bb21afd5d550. --- test/test_metacafe_ffilter.py | 32 -------------------------------- youtube_dl/extractor/metacafe.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 test/test_metacafe_ffilter.py diff --git a/test/test_metacafe_ffilter.py b/test/test_metacafe_ffilter.py deleted file mode 100644 index a981f88f9..000000000 --- a/test/test_metacafe_ffilter.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -import os -import sys -import unittest -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from test.helper import try_rm - -from youtube_dl import YoutubeDL - -class TestMetacafeFFilter(unittest.TestCase): - def test_metacafe(self): - filename = '2155630.mp4' - url = 'http://www.metacafe.com/watch/2155630/adult_art_by_david_hart_156/' - - params = { - 'skip_download': True, - 'writeinfojson': True, - 'outtmpl': '%(id)s.%(ext)s', - } - ydl = YoutubeDL(params) - ydl.add_default_info_extractors() - json_filename = os.path.splitext(filename)[0] + '.info.json' - try_rm(json_filename) - ydl.download([url]) - res = os.path.exists(json_filename) - try_rm(json_filename) - self.assertTrue(res) - - -if __name__ == '__main__': - unittest.main() diff --git a/youtube_dl/extractor/metacafe.py b/youtube_dl/extractor/metacafe.py index 6da69f84d..ecf3276b1 100644 --- a/youtube_dl/extractor/metacafe.py +++ b/youtube_dl/extractor/metacafe.py @@ -50,6 +50,19 @@ class MetacafeIE(InfoExtractor): }, 'skip': 'Page is temporarily unavailable.', }, + # metacafe video with family filter + { + 'url': 'http://www.metacafe.com/watch/2155630/adult_art_by_david_hart_156/', + 'md5': 'be6fe1f53864593349158bed94aae3a2', + 'info_dict': { + 'id': '2155630', + 'ext': 'mp4', + 'title': 'Adult Art By David Hart #156', + 'uploader': 'hartistry', + 'description': 'Adult Art By David Hart. All the Art Works presented here are not in the possession of the American Artist, David John Hart. The paintings are in collections worldwide of individuals, countries, art museums, foundations and charities.', + }, + 'skip': 'Page is temporarily unavailable.', + }, # AnyClip video { 'url': 'http://www.metacafe.com/watch/an-dVVXnuY7Jh77J/the_andromeda_strain_1971_stop_the_bomb_part_3/', From 53291d01d62f581b9703207722cf88db51d6b360 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sun, 4 Sep 2016 15:35:59 +0100 Subject: [PATCH 4/4] fix --- youtube_dl/extractor/metacafe.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/metacafe.py b/youtube_dl/extractor/metacafe.py index ecf3276b1..07fbc5091 100644 --- a/youtube_dl/extractor/metacafe.py +++ b/youtube_dl/extractor/metacafe.py @@ -53,15 +53,14 @@ class MetacafeIE(InfoExtractor): # metacafe video with family filter { 'url': 'http://www.metacafe.com/watch/2155630/adult_art_by_david_hart_156/', - 'md5': 'be6fe1f53864593349158bed94aae3a2', + 'md5': 'b06082c5079bbdcde677a6291fbdf376', 'info_dict': { 'id': '2155630', 'ext': 'mp4', 'title': 'Adult Art By David Hart #156', 'uploader': 'hartistry', 'description': 'Adult Art By David Hart. All the Art Works presented here are not in the possession of the American Artist, David John Hart. The paintings are in collections worldwide of individuals, countries, art museums, foundations and charities.', - }, - 'skip': 'Page is temporarily unavailable.', + } }, # AnyClip video {