Skip to content

Instantly share code, notes, and snippets.

@pagenoare
Created January 8, 2013 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pagenoare/4484564 to your computer and use it in GitHub Desktop.
Save pagenoare/4484564 to your computer and use it in GitHub Desktop.
# coding: utf-8
import urllib
import re
_PATTERN = re.compile('http://static.simpledesktops.com/uploads/desktops/([^\"]+)')
BASE_URL = 'http://simpledesktops.com/browse/%s/'
LAST_PAGE = 42
def extract_links(page_id):
opener = urllib.urlopen(BASE_URL % page_id)
content = opener.read()
opener.close()
return ['http://static.simpledesktops.com/uploads/desktops/%s' % img.replace('.295x184_q100.png', '') for img in _PATTERN.findall(content)]
urls = []
for i in range(0, LAST_PAGE + 1):
urls.extend(extract_links(i))
for url in urls:
print url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment