Exemplo n.º 1
0
    def download_url(self, url, savedirectory, embed="", poster=""):

        connector = http_connector.Connector()
        r_page = connector.reqhandler(url, 1)
        if r_page == '':
            raise IOError("Url not valid or nonexistent")


#        # be sure to have a url as a string and not as a list for savesource.py
#        url_string = connector.check_string_or_list(url)
# Generate the directory for the source file and the images downloaded
# Plus, return savedirectory as basedir + page title, so to save images
# on a per-site basis
#        source_saver = savesource.SaveSource(r_page, savedirectory, url_string, creditor=poster)
        source_saver = savesource.SaveSource(r_page,
                                             savedirectory,
                                             url,
                                             creditor=poster)
        savedirectory = source_saver.link_save()

        # Parse the page for images
        parser = ImageHostParser(r_page, 'a', 'href', savedirectory)
        if embed:
            # do we need to search for embedded images then?
            # Note: at the moment it downloads thumbnails too
            print("Searching for embedded images")
            print("")
            embed_links = parser.get_all_links('img', 'src')
            parser.which_host(embed_links, 'src')
Exemplo n.º 2
0
    def download_url(self, url, savedirectory, embed="", poster=""):
        
        connector = http_connector.Connector()
        r_page = connector.reqhandler(url, 1)
        if r_page == '':
            raise IOError("Url not valid or nonexistent")

#        # be sure to have a url as a string and not as a list for savesource.py
#        url_string = connector.check_string_or_list(url)
        # Generate the directory for the source file and the images downloaded
        # Plus, return savedirectory as basedir + page title, so to save images
        # on a per-site basis
#        source_saver = savesource.SaveSource(r_page, savedirectory, url_string, creditor=poster)
        source_saver = savesource.SaveSource(r_page, savedirectory, url, creditor=poster)
        savedirectory = source_saver.link_save()

        # Parse the page for images
        parser = ImageHostParser(r_page, 'a', 'href', savedirectory)
        if embed:
            # do we need to search for embedded images then?
            # Note: at the moment it downloads thumbnails too
            print("Searching for embedded images")
            print("")
            embed_links = parser.get_all_links('img', 'src')
            parser.which_host(embed_links, 'src')
Exemplo n.º 3
0
    def download_url(self, url, savedirectory, embed="", poster=""):
        
        connector = http_connector.Connector()
        r_page = connector.reqhandler(url, 1)


        # Generate the directory for the source file and the images downloaded
        # Plus, return savedirectory as basedir + page title, so to save images
        # on a per-site basis
        source_saver = savesource.SaveSource(r_page, savedirectory, url, creditor=poster)
        savedirectory = source_saver.link_save()

        # Parse the page for images
        parser = ImageHostParser(r_page, 'a', 'href', savedirectory)
        if embed:
            # do we need to search for embedded images then?
            # Note: at the moment it downloads thumbnails too
            print("Searching for embedded images")
            print("")
            embed_links = parser.get_all_links('img', 'src')
            parser.which_host(embed_links, 'src')
Exemplo n.º 4
0
    def download_url(self, url, savedirectory, embed="", poster=""):

        connector = http_connector.Connector()
        r_page = connector.reqhandler(url, 1)

        # Generate the directory for the source file and the images downloaded
        # Plus, return savedirectory as basedir + page title, so to save images
        # on a per-site basis
        source_saver = savesource.SaveSource(r_page,
                                             savedirectory,
                                             url,
                                             creditor=poster)
        savedirectory = source_saver.link_save()

        # Parse the page for images
        parser = ImageHostParser(r_page, 'a', 'href', savedirectory)
        if embed:
            # do we need to search for embedded images then?
            # Note: at the moment it downloads thumbnails too
            print("Searching for embedded images")
            print("")
            embed_links = parser.get_all_links('img', 'src')
            parser.which_host(embed_links, 'src')