Я хочу получить href url из функции onclick
javascript.
Это мой элемент кнопки
<button class="module_bnt" onclick="window.location.href='https://someurl.org/module/'"> Click Here to Start Quiz</button>`
Это моя функция синтаксического анализа.
def parse(self, response):
articles = response.xpath('//article')
for article in articles:
id = article.xpath('./@id').get()
if id is not None:
id = id.encode('utf-8') # converting to utf-8 and removing u character space in string
moduleBnt = article.xpath('.//button[@class="module_bnt"]/a/@href').get()
if moduleBnt is None:
moduleBnt = article.xpath(".//button[@class="module_bnt"]/a/@onclick").extract_first()
Может кто-нибудь помочь мне в этом? Заранее спасибо.