# Help with script to remove watched items from watchlist

**URL:** <https://forums.plex.tv/t/help-with-script-to-remove-watched-items-from-watchlist/841935>\
**Category:** General Discussions\
**Created:** [May 23, 2023, 2:58am UTC](https://forums.plex.tv/t/help-with-script-to-remove-watched-items-from-watchlist/841935 "2023-05-23T02:58:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonynks](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@tonynks](https://forums.plex.tv/u/tonynks)\
**Post date:** [May 23, 2023, 2:58am UTC](https://forums.plex.tv/t/help-with-script-to-remove-watched-items-from-watchlist/841935/1 "2023-05-23T02:58:32Z")

</div>

Can someone help with this script please?  
I keep getting 404 errors but the metadata is up to date. Here is my code

> Blockquote  
> from plexapi.myplex import MyPlexAccount  
> from plexapi.server import PlexServer  
> from plexapi.exceptions import NotFound

baseurl = ‘[http://192.168.100.191:32400](http://192.168.100.191:32400)’  
token = ‘secret’  
plex = PlexServer(baseurl, token)  
account = MyPlexAccount(token=token)

# Watchlist for all TV shows sorted by title in ascending order

watchlist = account.watchlist(sort=‘titleSort:asc’, libtype=‘show’)

# Remove the items in the watchlist that have been watched

for item in watchlist:  
try:  
watched = all(episode.isWatched for episode in item.episodes())  
if watched:  
print(f’Removing {item.title} from watchlist’)  
# item.removeFromWatchlist()  
except NotFound:  
print(f’Could not fetch episodes for {item.title}')

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [August 21, 2023, 2:59am UTC](https://forums.plex.tv/t/help-with-script-to-remove-watched-items-from-watchlist/841935/2 "2023-08-21T02:59:14Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
