# Session Report: Fix history tracking for YouTube queue videos ## User's original requests (verbatim) **Request 1:** > currently, the extension has no problems when updating the "history" data when viewing a youtube video. after it has started playing, I look in the history tab of the popup window, and I see the video, and the fact that I started watching it at the current time. however, if the video is part of a "queue" in youtube, it doesn't seem to register in the history. why might that be? take a look at `content_scripts/content.js` first, then `popup/popup.js` after that. **Request 2 (clarifying questions before implementation):** > to be clear, will your solution > > - not break any existing functionality? > - still only work on the "standard" youtube watch page? (ie: it should not record the in-thumnail video player on the front page that youtube now has) > - work whether it is the first video of a "queue" or any subsequent video in the queue? **Request 3 (go-ahead, with additional requirements):** > yes, go ahead and make the change > > as part of the change, ensure that only the true video id - which I think is denoted by the `v=` parameter in the url - is recorded as part of playlist entries or history entries. namely, other parameters in the url (like `list=`, `index=`, and `pp=`) should be removed. that way, when the extension navigates to the urls, youtube won't think that it's part of one of their playlists or queues. > > in the case of videos in the queue (where the page is not fully reloaded), ensure that the history entry reflects the up-to-date video id and title, etc. ## Diagnosis `content_scripts/content.js` ran `document.querySelector("video")` once, at content-script injection time, and attached `play`/`playing`/`pause`/`ended` listeners directly to that one `