При сохранении результатов скрипт python не сохраняет полные URL-адреса (см. Точки ...);
https://www.ibm.com/support/.../th/...9.../tasks-57.xhtml https://www.ibm.com/support/.../ko/...9.5.../help.xhtml https://www.ibm.com/support/.../fi/...7.../tasks-53.xhtml https://www.ibm.com/support/.../zh.../tasks-53.xhtml https://www.ibm.com/support/.../no/...9.5.../help.xhtml https://delivery04.dhe.ibm.com/.../8001-12C-22C--8005-12... https://www.ibm.com/support/.../da/...9.5.../help.xhtml
Я пробовал с Chromium и Chrome, но результаты те же.
Это следующий код, который нуждается в модификации:
while next_page is not None: print('parsing links from page..') # links_xpath = ".//*[@id='rso']//h3/a[@onmousedown and @href]/@href" links_xpath = "//*[@id='rso']//cite/text()" content = self.driver.page_source options = lh.fromstring(content) results = [link for link in options.xpath(links_xpath)] self.write_results_to_file(results, 'results_google_search.txt')
Если вместо:
links_xpath = "//*[@id='rso']//cite/text()"
Я поставил следующее:
links_xpath = ".//*[@id='rso']//h3/a[@onmousedown and @href]/@href"
Тамвыходные данные не сохраняются внутри 'results_google_search.txt'.
Любая помощь в решении этой проблемы будет очень признательна,
Спасибо:)