ikodan Posted March 9, 2017 Report Share Posted March 9, 2017 Hello, In order to download a lot of images for a personnal project, I'm looking for a way, from the source code of this kind of link : https://www.dreamstime.com/search.php?securitycheck=1ca077d0e2dd106ec49a55a750695398&srh_field=chicken&firstvalue=enter+keyword+or+file+ID&lastsearchvalue=&s_catid=0&s_cliid=2503490&s_colid=&s_ph=y&s_video=y&s_audio=y&s_il=y To keep only the links of the thumbs, for exemple for the chicken : https://thumbs.dreamstime.com/t/full-body-brown-chicken-hen-standing-isolated-white-backgroun-background-use-farm-animals-livestock-theme-49741285.jpg The kind of code to remove arround the links : <img class="bigthumb showonload" id="bigthumb49741285" src="https://thumbs.dreamstime.com/t/full-body-brown-chicken-hen-standing-isolated-white-backgroun-background-use-farm-animals-livestock-theme-49741285.jpg" alt="Full body of brown chicken hen standing isolated white backgroun Royalty Free Stock Photo" style="height: 158px; width: 162px; margin-top: 0px; visibility: visible;"> Then I want to replace the /t/ on the link by /z/ Can someone help me please ? Quote Link to comment Share on other sites More sharing options...
rberq Posted March 9, 2017 Report Share Posted March 9, 2017 Get all the source code into a Macro Express text variable. It looks like you can find the links you want by searching for the /t/ string. You can do that with command Variable Set Integer [Get Position of Text in a Text Variable]. Once you have the integer index pointing to /t/ within the source code, you can back up one character at a time looking for https: (the beginning of the link). That is, use a Repeat loop to decrement the index integer by one, copy 6 characters to another variable using command Variable Modify String [Copy Part of Text], and check whether the copied text is https: Exit from the Repeat loop when the match is found. At this point your integer (index) points to the beginning of the link. Find the end of the link with a similar Repeat loop incrementing the index until you find the double-quote. Now you know the beginning and ending positions of the link text, and you can use Variable Modify String [Copy Part of Text] to copy the whole link text to another variable, save it in a text file, or whatever. Use Variable Modify String [Replace Substring] to change /t/ to /z/. Use Variable Modify String [Delete Part of Text] to delete everything from the beginning of the source code to the end of the link you just extracted. Then repeat all the logic above to extract the next link, and so on until done. Quote Link to comment Share on other sites More sharing options...
acantor Posted March 10, 2017 Report Share Posted March 10, 2017 The final step is perhaps the easiest. To replace /t/ with /z/... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.