尝试用jQuery替换图像文件名

I'm trying to grab a image name and replace it. From default.jpg to maxresdefault.jpg. However, the script I'm using throws an error, when it seems to me it should be working.

HTML:

<a href="https://xxxxxxxxx.html" rel="nofollow" target="_self" title="Sample post with one video, part three">
  <div class="related-posts-thumb" itemprop="thumbnailURL" style="background: url(https://img.youtube.com/vi/iBy8UdG3VOo/default.jpg)"></div>
</a>

jQuery的:

<!-- LET'S IMPROVE IMAGE QUALITY OF YOUTUBE THUMBNAILS IN THE RELATED POSTS -->
$('#main-content #Blog1 article .related-posts .related-content article .related-posts-thumb').each(function() {
  $(this).attr("src", $(this).attr("src").replace("default.jpg", "maxresdefault.jpg"));
});

This returns the error: Cannot read property 'replace' of undefined

只是比较一下,下面一个不起作用的脚本是我使用的类似脚本,它可以正常工作:

<!-- LET'S IMPROVE IMAGE QUALITY OF AVATARS IN THE COMMENTS -->
$('#main-content #Blog1 article #comments .comment .avatar-image-container img').each(function() {
  $(this).attr("src", $(this).attr("src").replace("s35", "s72"));
});

Why is the script not working? Two similar scripts, one works, and one doesn't. I even tried the one mentioned here at stackoverflow, but it still has the same problem.