Need to download videos from a website

I am trying to download videos from a website but I need it to automatically repeat the macro. So for instance, on this page I would create a macro clicking on the first video, selecting the title and copying it (Blurred Bokeh Video), clicking download, pasting the name into the corresponding field and then clicking save. For this video the name is present but it is not always the case. The issue is iterating that throughout the entire page. Any idea how to do that?

Thank you!

As often, the (somewhat hidden) loop button helps here:

If you click the videos, you will notice the recorded xpath differs only by a number:

  • /html/body/div[2]/div[1]/article[1]/div/a/ul/li[15]
  • /html/body/div[2]/div[1]/article[2]/div/a/ul/li[15]
  • /html/body/div[2]/div[1]/article[3]/div/a/ul/li[15]

so we replace it with ${!LOOP} (which contains the number of the current loop)

  • /html/body/div[2]/div[1]/article[${!LOOP}]/div/a/ul/li[15]

and start the macro with the LOOP button => all videos downloaded :slight_smile:

{
  "CreationDate": "2018-11-19",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://videos.pexels.com/",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "/html/body/div[2]/div[1]/article[2]/div/a/ul/li[15]",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "/html/body/div[2]/div[1]/article[${!LOOP}]/div/a/ul/li[15]",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "link=Free Download",
      "Value": ""
    }
  ]
}

download1

1 Like

amazing! thank you! But how would I copy the name to the file name and paste it into the save as dialogue and how do I close the tab at the end of the loop? Could I just save the filename to a csv?

  1. To extract the file name, use Store Text
  2. To store the value in a csv, use
    store | ${yourValueFromStep1} | !CSVLine
    csvSave | YourList
  3. To close the tab, use selectWindows | Tab=CloseAllother

I did not get this part. Do you want to change the default download file name? This is possible, but in this case you need to automate the file download dialog with the native OS command xclick and xtype

1 Like

I did not get this part. Do you want to change the default download file name? This is possible, but in this case you need to automate the file download dialog with the native OS command xclick and xtype

Lets take this for example.

Lets say I wanted to replace the native filename with the category(s) and the author instead and then save the filename into a download manager ( Free Download Manager ). How would you accomplish that?

One last question, is there a way to confirm the file downloaded was started when I run this command and retry until it does?

Finally, the loop function is awesome! Thank you for all the help! I really appreciate it.