Exemplo n.º 1
0
 def save(self) -> None:
     """ Saves the file to local disk """
     response = Request.get(self.download_link())
     if response.status_code != 200:
         raise ValueError(response.status_code)
     with open(self.tmp_file_path, 'wb') as tmp_file:
         tmp_file.write(response.content)
Exemplo n.º 2
0
 def download_link(self) -> str:
     """ :returns: link where the file awaits to be downloaded """
     data = Request.get(self.url).content
     soup = BeautifulSoup(data, "html.parser")
     track_meta = json.loads(BandcampJSON(soup).generate()[0])
     if track_meta['trackinfo'][0]['file'] is None:
         raise ValueError("could not find mp3 in %s" % self.url)
     return "https:" + track_meta['trackinfo'][0]['file']['mp3-128']
Exemplo n.º 3
0
 def page(self) -> str:
     """ :returns: html for tag's/genre's page """
     return Request.get(self.url()).content
Exemplo n.º 4
0
 def page(self) -> str:
     """ :returns: album's page html """
     return Request.get(self.url).content