lalamus.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. from sites.default import DefaultSite
  2. from helper.sites.query import Query
  3. class Lalamus(DefaultSite):
  4. def __init__(self):
  5. super().__init__()
  6. self.url = 'https://wwc.lalamus.mobi'
  7. self.query = Query(self, 'FLAT', 'music')
  8. self.structure\
  9. .set_container_path('div.playlist-hash')\
  10. .set_item_path('table.song')\
  11. .set_title_path('td.title')\
  12. .set_duration_path('td.time') \
  13. .set_url_path('button.btn_download')
  14. self.request\
  15. .add_header('Referer', self.url + '/')\
  16. .add_header('Origin', self.url)\
  17. .add_header('Content-Type', 'application/x-www-form-urlencoded')
  18. def format_url(self, field):
  19. script = field.attr.onclick
  20. _start = 'openDL(\''
  21. _end = '\''
  22. start = script.find(_start)
  23. if start > -1:
  24. end = script.find(_end, start+len(_start))
  25. if end > -1 and end > start:
  26. return '{0}{1}'.format(self.url, script[start+len(_start):end])
  27. return None