I’m new to iMacros, and I’m trying to make a macro that could transfer all the videos from my old “Favorites” playlist on YouTube to the “Liked videos” section.
The idea is to go through all the videos of the playlist, and press the like button on each video, unless it is already pressed.
Config info:
- iMacros version 10.0.2.1450 (free version)
- Ubuntu 20.10, English
- Firefox 89.0a1 (2021-04-05) (64-bit)
- Some videos are already liked, so the button should not be pressed in that case.
- On the already-liked videos, the “Dislike” button should never be pressed, even if it is the first matching unpressed button.
- If the button is already pressed and the selector therefore doesn’t match, it should just skip to the next video.
- The playlist page has infinite scroll, so to be able to index all the videos, it should be scrolled down.
- Open the playlist.
- Scroll down and down and down until all the list is loaded.
- Index all the URLs for all the videos in the list.
- Visit all the videos one by one, and for each of them:
- Locate the first button in the “Like/Dislike” pair of buttons.
- If, and only if, the button is not pressed already, press it.
- Go the the next video, etc.
To kickstart the thing, some CSS selectors that can select the right button in the right state:
Code: Select all
#top-level-buttons > ytd-toggle-button-renderer:first-child yt-icon-button.style-text:not(.style-default-active")
Code: Select all
#top-level-buttons yt-icon-button button[aria-label^="like"][aria-pressed="false"]:not([aria-label^="dislike"]):not([aria-pressed="true"])
Code: Select all
URL GOTO=https://www.youtube.com/playlist?list=URL-OF-PLAYLIST
TAG POS={{!LOOP}} TYPE=A ATTR=ID:video-title
SET !ERRORIGNORE YES
TAG SELECTOR="#top-level-buttons > ytd-toggle-button-renderer:first-child yt-icon-button.style-text"
SET !ERRORIGNORE NO
Can someone more experienced help me build this?
Thanks!!