Example #1
0
 def __init__(self, HTML):
     try:
         regex_xml = search(r'xmlPath=(.+?)&adsLink', HTML)
         xml_file = regex_xml.group(1)
         h = hrequest.hrequest()
         cookie, xml_data = h.request(xml_file, data=None, HTMLResponse=True)
         self.xml_data = xml_data
     except:
         print 'Can not get xml data file'
         sys.exit(1)
Example #2
0
 def __init__(self, HTML):
     try:
         regex_xml = search(r'\'playlistfile\': \'(.+?)\',', HTML)
         xml_file = regex_xml.group(1)
         xml_file = 'http://hn.nhac.vui.vn' + xml_file
         h = hrequest.hrequest()
         cookie, xml_data = h.request(xml_file, data=None, HTMLResponse=True)
         self.xml_data = xml_data.replace('jwplayer:file', 'jwplayerfile')
     except:
         print 'Can not get xml data file'
         sys.exit(1)
Example #3
0
 def __init__(self, HTML):
     try:
         regex_xml = search(r'file=(.+?)" \/>', HTML)
         xml_file = regex_xml.group(1)
         h = hrequest.hrequest()
         cookie, xml_data = h.request(xml_file,
                                      data=None,
                                      HTMLResponse=True)
         self.xml_data = xml_data
     except:
         print 'Can not get xml data file'
         sys.exit(1)
Example #4
0
 def __init__(self, HTML):
     try:
         self.HTML = HTML
         regex_link = search(r'<meta property="og:url" content="(.+?)" />', self.HTML)
         id_link = regex_link.group(1)
         id_link = id_link.split('/')[-1].replace('.html', '')
         xml_file = 'http://www.keeng.vn/album/get-album-xml?album_identify=' + id_link
         h = hrequest.hrequest()
         cookie, xml_data = h.request(xml_file, data=None, HTMLResponse=True)
         self.xml_data = xml_data 
     except:
         print 'Can not get xml data file'
         sys.exit(1)
Example #5
0
 def __init__(self, HTML):
     try:
         self.HTML = HTML
         regex_link = search(r'<meta property="og:url" content="(.+?)" />',
                             self.HTML)
         id_link = regex_link.group(1)
         id_link = id_link.split('/')[-1].replace('.html', '')
         xml_file = 'http://www.keeng.vn/album/get-album-xml?album_identify=' + id_link
         h = hrequest.hrequest()
         cookie, xml_data = h.request(xml_file,
                                      data=None,
                                      HTMLResponse=True)
         self.xml_data = xml_data
     except:
         print 'Can not get xml data file'
         sys.exit(1)
Example #6
0
            if not buffer:
                break
            file_size_dl += len(buffer)
            f.write(buffer)
            status = r"%10d  [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
            status = status + chr(8)*(len(status)+1)
            print status
        f.close()
    except HTTPError, e:    
        print "Error: " + str(e.code)

if len(sys.argv) > 1:
    url = sys.argv[1]
    print "Download: " + url
    domain = urlparse(url).netloc.replace('.', '').replace('www', '')
    h = hrequest.hrequest()
    if domain:    
        from hsite import *
        cookie, html = h.request(url, data=None, HTMLResponse=True)
        try:
            domain = eval(domain)
            mp3 = domain.MP3(html)
            hlist = mp3.parse()
            for item in hlist:
                title, artist, source = item
                source = source.strip()
                print "\t[+] " + title.strip()
                file_name = title.strip().replace(' ', '-')
                wget(source, file_name)
        except:
            print 'Can not parse ' + str(domain)    
Example #7
0
            file_size_dl += len(buffer)
            f.write(buffer)
            status = r"%10d  [%3.2f%%]" % (file_size_dl,
                                           file_size_dl * 100. / file_size)
            status = status + chr(8) * (len(status) + 1)
            print status
        f.close()
    except HTTPError, e:
        print "Error: " + str(e.code)


if len(sys.argv) > 1:
    url = sys.argv[1]
    print "Download: " + url
    domain = urlparse(url).netloc.replace('.', '').replace('www', '')
    h = hrequest.hrequest()
    if domain:
        from hsite import *
        cookie, html = h.request(url, data=None, HTMLResponse=True)
        try:
            domain = eval(domain)
            mp3 = domain.MP3(html)
            hlist = mp3.parse()
            for item in hlist:
                title, artist, source = item
                source = source.strip()
                print "\t[+] " + title.strip()
                file_name = title.strip().replace(' ', '-')
                wget(source, file_name)
        except:
            print 'Can not parse ' + str(domain)