class Pixiv_Get_Error(Exception):
    def __init__(self, url):
        self.url = url

    def __str__(self):
        return 'Failed to get data: ' + self.url


def get_image_url_per_illust(data):
    """
    get image_urls from one data
    """
    image_urls = []
    # extract work if the raw data is from ranking
    if 'work' in data:
        data = data['work']

    # not manga
    if not data['is_manga']:
        image_urls.append(data['image_urls']['large'])
    # manga
    else:
        for i in range(data['page_count']):
            per_page_link = data['image_urls']['large'][:-5] + str(i) + data['image_urls']['large'][-4:]
            image_urls.append(per_page_link)
    return image_urls

@@ -156,552 +156,4 @@
 url%0A
-%0A%0Adef get_image_url_per_illust(data):%0A    %22%22%22%0A    get image_urls from one data%0A    %22%22%22%0A    image_urls = %5B%5D%0A    # extract work if the raw data is from ranking%0A    if 'work' in data:%0A        data = data%5B'work'%5D%0A%0A    # not manga%0A    if not data%5B'is_manga'%5D:%0A        image_urls.append(data%5B'image_urls'%5D%5B'large'%5D)%0A    # manga%0A    else:%0A        for i in range(data%5B'page_count'%5D):%0A            per_page_link = data%5B'image_urls'%5D%5B'large'%5D%5B:-5%5D + str(i) + data%5B'image_urls'%5D%5B'large'%5D%5B-4:%5D%0A            image_urls.append(per_page_link)%0A    return image_urls%0A

move get_image_url_per_illust to model.py