Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions goose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"""
import os
import platform
import urllib2
from tempfile import mkstemp

from goose.version import version_info, __version__
Expand Down Expand Up @@ -52,6 +53,11 @@ def extract(self, url=None, raw_html=None):
Main method to extract an article object from a URL,
pass in a url and get back a Article
"""
scheme, address = urllib2.splittype(url)

if not scheme:
url = self.config.default_scheme + url

cc = CrawlCandidate(self.config, url, raw_html)
return self.crawl(cc)

Expand Down
4 changes: 4 additions & 0 deletions goose/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def __init__(self):
# http timeout
self.http_timeout = HTTP_DEFAULT_TIMEOUT

# default url scheme
# it will be use as fallback if url doesnt conain one
self.default_scheme = 'http://'

def get_parser(self):
return AVAILABLE_PARSERS[self.parser_class]

Expand Down