Example #1
0
def grab_html(short_set):
    ids = read_ids(short_set)
    for idx, id in enumerate(ids):
        for printed in ('true', 'false'):
            url = CARD_URL % locals()
            html = tools.grab_url(url)
            write_html(id, html, short_set, printed)
        card_name = extract_card_name(html)
        print "Grabbed card:\t%d\t(%3d/%d)\t%s" % (id, idx+1, len(ids),
              card_name)
    print "Done"
Example #2
0
def grab_images(short_set):
    """ Download all card images for the given set. """

    path = os.path.join('images', short_set)
    if not os.path.exists(path):
        os.makedirs(path)

    ids = grab_html.read_ids(short_set)
    for idx, id in enumerate(ids):
        url = IMAGE_URL % locals()
        data = tools.grab_url(url)
        print "Grabbed image: %s" % id
        write_image(short_set, id, data)
Example #3
0
def grab_page(page, escaped_set_name):
    url = SEARCH_URL % locals()
    return tools.grab_url(url)