diff --git a/goose/network.py b/goose/network.py index d05d636b..e44e6a0a 100644 --- a/goose/network.py +++ b/goose/network.py @@ -21,7 +21,7 @@ limitations under the License. """ import urllib2 - +import cookielib class HtmlFetcher(object): @@ -37,6 +37,10 @@ def get_html(self, config, url): """ if isinstance(url, unicode): url = url.encode('utf-8') + + cookiejar = cookielib.LWPCookieJar() + opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar)) + urllib2.install_opener(opener) headers = {'User-agent': config.browser_user_agent} request = urllib2.Request(url, headers=headers)