{ "info": { "author": "maisano", "author_email": "rickmaisano@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Programming Language :: Python" ], "description": "Snatch: Simple Image Scraping in Python\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nConfigurable, extensible image scraping for Python. Inspired by the design and internals of Kenneth Reitz' `Requests `_ library.\n\n.. code-block:: python\n\n >>> from snatch import snatch\n >>> images = snatch('http://octodex.github.com/pythocat/')\n >>> images.extensions\n [u'png']\n >>> images[1]\n \n >>> images[1].url\n u'http://octodex.github.com/images/pythocat.png'\n\nEasily usable, easily configurable:\n\n.. code-block:: python\n\n >>> url = 'url/with/54/images'\n >>> snatch(url)\n \n\n # reduce your results by extension:\n >>> _.with_extension('gif')\n \n\n # or more explicitly limit your extension in the inital api call:\n >>> snatch(url, with_extension=('gif',))\n \n\nIt's also very easy to hook your own filters or operations into Snatch's callbacks system. Let's say you only wanted to capture images that were larger than 250 px wide:\n\n.. code-block:: python\n\n import requests\n import Image\n from StringIO import StringIO\n from snatch import snatch\n\n def wider_than_250(images):\n def filter_fn(image):\n if image.width is None:\n res = requests.get(image.src)\n img = Image.open(StringIO(res.content))\n image.width = img.size[0]\n return image.width > 250\n return filter(filter_fn, images)\n\n url = 'http://octodex.github.com/images/pythocat.png'\n callbacks = {'complete': wider_than_250}\n images = snatch(url, callbacks=callbacks)\n\n\nAnd even simpler to download all images from a URL:\n\n.. code-block:: python\n\n import os\n import requests\n from snatch import snatch\n\n directory = 'snatched-images'\n\n if not os.path.exists(directory):\n os.mkdir(directory)\n\n for image in snatch('http://octodex.github.com/pythocat/'):\n contents = requests.get(image.url).content\n with open('%s/%s' % (directory, image.filename), 'w') as image_file:\n image_file.write(contents)\n\n\n.. :changelog:\n\nRelease History\n---------------\n\n\n0.1.0 (2013-10-12)\n++++++++++++++++++\n\n- Initial write/scaffold, lots to fix/improve upon", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/maisano/snatch", "keywords": "image scraping", "license": "Copyright 2013 Richard Maisano\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.", "maintainer": null, "maintainer_email": null, "name": "snatch", "package_url": "https://pypi.org/project/snatch/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/snatch/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/maisano/snatch" }, "release_url": "https://pypi.org/project/snatch/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Simple image scraping in Python", "version": "0.1.0" }, "last_serial": 936132, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "da988461a3cb4b5761b51bf9b0ce76d9", "sha256": "32e7e86b14de2064ee9860c4a99caa99a2a471fd5dc8201de83717d630f94aeb" }, "downloads": -1, "filename": "snatch-0.1.0.tar.gz", "has_sig": false, "md5_digest": "da988461a3cb4b5761b51bf9b0ce76d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6689, "upload_time": "2013-12-04T20:05:03", "url": "https://files.pythonhosted.org/packages/25/10/9d44219c75316c268b334b3cf9becc673d811c61b04cca59d622e49684eb/snatch-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "da988461a3cb4b5761b51bf9b0ce76d9", "sha256": "32e7e86b14de2064ee9860c4a99caa99a2a471fd5dc8201de83717d630f94aeb" }, "downloads": -1, "filename": "snatch-0.1.0.tar.gz", "has_sig": false, "md5_digest": "da988461a3cb4b5761b51bf9b0ce76d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6689, "upload_time": "2013-12-04T20:05:03", "url": "https://files.pythonhosted.org/packages/25/10/9d44219c75316c268b334b3cf9becc673d811c61b04cca59d622e49684eb/snatch-0.1.0.tar.gz" } ] }