Items can requests their download URL by themselves
This commit is contained in:
parent
86cfb3bf94
commit
c9a832b6ee
@ -4,7 +4,8 @@
|
|||||||
class song(object):
|
class song(object):
|
||||||
""" Represents a song in all services. Data will be filled by the service itself"""
|
""" Represents a song in all services. Data will be filled by the service itself"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, extractor):
|
||||||
|
self.extractor = extractor
|
||||||
self.bitrate = 0
|
self.bitrate = 0
|
||||||
self.title = ""
|
self.title = ""
|
||||||
self.artist = ""
|
self.artist = ""
|
||||||
@ -14,4 +15,7 @@ class song(object):
|
|||||||
self.download_url = ""
|
self.download_url = ""
|
||||||
|
|
||||||
def format_track(self):
|
def format_track(self):
|
||||||
return "{0}. {1}. {2}".format(self.title, self.duration, self.size)
|
return "{0}. {1}. {2}".format(self.title, self.duration, self.size)
|
||||||
|
|
||||||
|
def get_download_url(self):
|
||||||
|
self.download_url = self.extractor.get_download_url(self.url)
|
@ -22,7 +22,7 @@ class interface(object):
|
|||||||
self.hd = [{'duration': re.search(D, str(x)).group()[13:], 'size': re.search(R, str(x)).group()[7:], 'bitrate': re.search(B, str(x)).group()[8:]} for x in soup.find_all('div', {'class': "result__snp"})]
|
self.hd = [{'duration': re.search(D, str(x)).group()[13:], 'size': re.search(R, str(x)).group()[7:], 'bitrate': re.search(B, str(x)).group()[8:]} for x in soup.find_all('div', {'class': "result__snp"})]
|
||||||
self.results = []
|
self.results = []
|
||||||
for i in range(len(self.hd)):
|
for i in range(len(self.hd)):
|
||||||
s = baseFile.song()
|
s = baseFile.song(self)
|
||||||
s.title = self.dh[i][0]
|
s.title = self.dh[i][0]
|
||||||
s.url = self.dh[i][1]
|
s.url = self.dh[i][1]
|
||||||
s.duration = self.hd[i]["duration"]
|
s.duration = self.hd[i]["duration"]
|
||||||
|
Loading…
Reference in New Issue
Block a user