Tasker [SOLVED] Play un-watched videos from YouTube playlist?

Discussion in 'Guides / Examples / Ideas Forum' started by Jao, Nov 8, 2018.

  1. Jao

    Jao New Member

    Joined:
    Oct 13, 2016
    Messages:
    4
    Likes Received:
    0
    SOLVED: See post #3

    original post:
    I'm trying to build a task that can play the first video I haven't yet watched from my "watch later" playlist on YouTube.

    Any ideas how to differentiate between watched and unwatched through Tasker?
     
    Last edited: Nov 12, 2018
  2. Jao

    Jao New Member

    Joined:
    Oct 13, 2016
    Messages:
    4
    Likes Received:
    0
    Update:
    So I figured out how to grab the videos and check if they're unwatched digging through youtube' website source. So, HTTP GET should be the way to go here.

    BUT, my issue now is: How can I use HTTP GET as if I am logged into YouTube? A normal HTTP GET will not have info on what I (on my account) have/have not watched.
     
  3. Jao

    Jao New Member

    Joined:
    Oct 13, 2016
    Messages:
    4
    Likes Received:
    0
    FINAL UPDATE: Solved!
    I'm sure there are more efficient ways using java or something, but this is what I did:

    1) AutoTools --> HTML READ on my YouTube "watch later" playlist with the CSS query as html
    -- This essentially uses HTML READ as HTTP GET, except using AutoTools will pull the source as if I am logged into YouTube. So, it pulls the source of my personal watch later playlist page.

    2) Split the source with rl";"/watch?v=
    -- This splits just before the videoID of each vid. in the playlist.

    3) Set up an IF statement to check if DurationWatched is NOT found in the split. When checking split1/2/3/etc, I set it up as split(%num) so I can loop back through.
    -- Only videos that have been watched will have this in their split portion

    4) If the statement comes up true, split down to the videoID & using Browse URL on https://www. youtube.com/watch?v=%videoid&t=0&list=WL (without the space of course)

    5) If the statement is false, increment the %num variable and loop back to the beginning of the if statement.

    The downside is this only works on the first 20 videos in the watch later playlist. YouTube won't load more vids unless "see more" is clicked. This isn't a big deal though. I'm happy with how this turned out.
    Task link: https://taskernet.com/shares/?user=...w0cu3ehIR+C7Mz8r1w==&id=Task:Play+Watch+Later
     
    Last edited: Nov 12, 2018
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Glad you got it :D
     

Share This Page