| 1234567891011121314151617181920212223242526272829303132333435 |
- from sites.default import DefaultSite
- from helper.sites.query import Query
- class Czne(DefaultSite):
- def __init__(self):
- super().__init__()
- self.url = 'https://nowoscimuzyczne.eu'
- self.query = Query(self, 'POST')\
- .add_parameter('do', 'search')\
- .add_parameter('subaction', 'search')\
- .add_parameter('story', '{0}')
- self.structure\
- .set_container_path('div#dle-content')\
- .set_item_path('article.short-story')\
- .set_title_path('div.short-title')\
- .set_url_path('div.wpisplayer script:first')
- self.request\
- .add_header('Referer', self.url + '/')\
- .add_header('Origin', self.url)\
- .add_header('Content-Type', 'application/x-www-form-urlencoded')
- def format_url(self, field):
- script = field.text()
- _start = 'var link=\''
- _end = '\';'
- start = script.find(_start)
- if start > -1:
- end = script.find(_end)
- if end > -1 and end > start:
- return script[start+len(_start):end]
- return None
|