From bd41a3b73e28b849d2e80400fa3b7e0c791b3659 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 23 Oct 2012 04:11:44 +0200 Subject: [PATCH] dailymotion: Fix search-then-play combination refs #860 --- modules/dailymotion/browser.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/dailymotion/browser.py b/modules/dailymotion/browser.py index 5f40f685..6b840d93 100644 --- a/modules/dailymotion/browser.py +++ b/modules/dailymotion/browser.py @@ -40,6 +40,13 @@ class DailymotionBrowser(BaseBrowser): @id2url(DailymotionVideo.id2url) def get_video(self, url, video=None): + # clear cookies. + # this is required in some weird cases, namely *interactive* videoob usage + # to avoid getting 403 errors when getting the video URL after a search. + # + # better control of this issue would be nice (especially if we support user login) + self._ua_handlers['_cookies'].cookiejar.clear() + # translate embed URLs url = url.replace('dailymotion.com/swf/', 'dailymotion.com/video/') self.location(url)