Dominik2810 Posted October 9, 2018 Share Posted October 9, 2018 Hi all, I am new to AutoIT and hope that you can help me with a pretty simple problem. Problem: I have a website with multiple links that need to be extracted Task: First I want to extract all links that contain the substring "https://www.twst.com/interview/" in their HTML tagging. Secondly I want to write the links (URLs) into a Notepad (-txt) file. Please finde attached two pictures of exaple URLs in the HTML of the website. Result: What the Notepad file should look like (linewise entries of the URLs): https://www.twst.com/interview/actively-managing-a-blockchain-and-cryptocurrency-etf https://www.twst.com/interview/sticking-to-the-process-to-add-yield-and-deliver-returns ..... Any ideas how to do that? Many thanks in advance! Link to comment Share on other sites More sharing options...
Earthshine Posted October 9, 2018 Share Posted October 9, 2018 so you want someone else to code it for you? show us what you have tried please. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Subz Posted October 9, 2018 Share Posted October 9, 2018 I'm bored so here is a working example: #include <IE.au3> Local $bFileOpen = False, $hFileOpen, $sFileOpen = @ScriptDir & "\twstlinks.txt" Local $sSearch = "https://www.twst.com/interview/" Local $iSearch = StringLen($sSearch) Local $oIE = _IECreate("https://www.twst.com/", 1) Local $oLinks = _IELinkGetCollection($oIE) If IsObj($oLinks) Then For $oLink In $oLinks If StringLeft($oLink.href, $iSearch) = $sSearch Then _WriteLinks($oLink.href) Next EndIf If $bFileOpen Then FileClose($hFileOpen) Func _WriteLinks($_sLink) If $bFileOpen Then FileWrite($hFileOpen, $_sLink & @CRLF) Else $hFileOpen = FileOpen($sFileOpen, 1) FileWrite($hFileOpen, $_sLink & @CRLF) $bFileOpen = True EndIf EndFunc FrancescoDiMuro 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now