Trying to make sure I’m understanding the flow of steps occurring here, for what you’re describing.
Pretend it’s me doing this:
1. Pasting a youtube video link into the start of post content.
2. Click publish/save.
As per what the plugin is supposed to do for the following steps.
3. The plugin grabs the post content, and parses out the video url unique ID.
4. Plugin makes a request to the Youtube API to find the associated generated thumbnails by Youtube themselves.
5. Plugin handles uploading and saving to the media library.
6. Plugin saves the attachment ID to the appropriate spot to store as the featured image, and finishes its task.
If I’m reading you correctly, you set your own image other than what step 4 found, and replaced the automated image with it? It’s at this point that it’s felt that the created media library item from step 5 should be deleted completely because it wasn’t, after all that, used in the end?
I’ve checked our code, and it should only uploading and processing into the library if there’s not a post thumbnail already. We don’t “trample” on existing content. However, if there’s not one already, and then things get processed, and then the featured image is switched to something else afterwards, then that would leave behind the original thumbnail from the upload still. It would prevent re-trying to upload as well, upon next save.