107 | 108 | 109 | 110 | 111 | Home
112 | 113 | Reblogged from the-streetstyle
114 |
119 | FUCK YEAH
(via patentleather)
120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 |├── tests ├── __init__.py ├── fixtures │ ├── no_image_page.html │ ├── fragment.html │ ├── page.html │ └── tumblr.html └── test.py ├── haul ├── extenders │ ├── __init__.py │ └── pipeline │ │ ├── __init__.py │ │ ├── pinterest.py │ │ ├── wordpress.py │ │ ├── tumblr.py │ │ └── google.py ├── finders │ ├── __init__.py │ └── pipeline │ │ ├── __init__.py │ │ ├── html.py │ │ └── css.py ├── __init__.py ├── api.py ├── compat.py ├── utils.py ├── settings.py ├── exceptions.py └── core.py ├── requirements_test.txt ├── requirements.txt ├── MANIFEST.in ├── .gitignore ├── .travis.yml ├── HISTORY.rst ├── LICENSE ├── setup.py └── README.rst /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /haul/extenders/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /haul/finders/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /haul/finders/pipeline/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /haul/extenders/pipeline/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements_test.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | coveralls 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4 2 | cssutils 3 | html5lib 4 | lxml 5 | requests 6 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | include HISTORY.rst 4 | include requirements.txt 5 | include requirements_test.txt 6 | -------------------------------------------------------------------------------- /haul/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | __version__ = '1.3.1' 4 | 5 | from .api import find_images 6 | from .core import Haul, HaulResult 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | *.egg 4 | *.egg-info 5 | dist 6 | build 7 | sdist 8 | 9 | .coverage 10 | htmlcov/ 11 | 12 | .codeintel 13 | .DS_STORE 14 | -------------------------------------------------------------------------------- /haul/api.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from .core import Haul 4 | 5 | 6 | def find_images(url_or_html, *args, **kwargs): 7 | h = Haul() 8 | 9 | return h.find_images(url_or_html, *args, **kwargs) 10 | -------------------------------------------------------------------------------- /tests/fixtures/no_image_page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |no image
9 | 10 | 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | python: 4 | - "2.7" 5 | 6 | before_install: 7 | - sudo apt-get update -qq 8 | - sudo apt-get install -qq libxml2-dev libxslt1-dev 9 | 10 | install: 11 | - pip install -r requirements.txt --use-mirrors 12 | - pip install -r requirements_test.txt --use-mirrors 13 | 14 | script: 15 | - coverage run --source=haul setup.py test 16 | 17 | notifications: 18 | email: 19 | - vinta.chen@gmail.com 20 | 21 | after_success: 22 | - coveralls 23 | -------------------------------------------------------------------------------- /haul/compat.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | haul.compat 5 | ~~~~~~~~~~~ 6 | 7 | This module contains imports and declarations for seamless Python 2 and 8 | Python 3 compatibility. 9 | """ 10 | 11 | import sys 12 | 13 | 14 | _version = sys.version_info 15 | 16 | is_py2 = (_version[0] == 2) 17 | is_py3 = (_version[0] == 3) 18 | 19 | if is_py2: 20 | from urlparse import urljoin, urlparse 21 | 22 | str = unicode 23 | 24 | elif is_py3: 25 | from urllib.parse import urljoin, urlparse 26 | 27 | str = str 28 | -------------------------------------------------------------------------------- /haul/utils.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import cStringIO 4 | import sys 5 | 6 | 7 | def import_module(name): 8 | __import__(name) 9 | 10 | return sys.modules[name] 11 | 12 | 13 | def module_member(name): 14 | mod, member = name.rsplit('.', 1) 15 | module = import_module(mod) 16 | 17 | return getattr(module, member) 18 | 19 | 20 | def read_file(path): 21 | with open (path, 'r') as f: 22 | content = f.read() 23 | 24 | return content 25 | 26 | 27 | def pack_image(self, content): 28 | string_io = cStringIO.StringIO(content) 29 | 30 | return string_io 31 | -------------------------------------------------------------------------------- /HISTORY.rst: -------------------------------------------------------------------------------- 1 | History 2 | ======= 3 | 4 | 1.3.2 (2013-11-05) 5 | ++++++++++++++++++ 6 | 7 | - Bug fixed: `#12
3 |
4 | some image
5 |
6 |
11 |
12 |
13 | unicode image url
14 |
15 |
16 |
22 |
23 |
12 |
13 | some image
14 |
15 |
20 |
21 |
22 | unicode image url
23 |
24 |
25 |
31 |
32 |
119 | FUCK YEAH
(via patentleather)
120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 |139 | 140 |
160 | 161 | FUCK YEAH 162 |163 | 164 | 165 |
598 | 599 | Street chic 600 |601 | 602 | 603 |