How to get the title, if there is no “h1” or similar?
<div class="channel-videos-title">
<a href="/video/VIDEO-ID/" class="spa">VIDEO-TITLE</a>
</div>
The main thing to do here is to choose a better item element. Your version will pick the first <a>
element for the URL and title. If you select the inner item element <div class="channel-videos-text-container">...</div>
you’ll get the result you want:
(I modified it to to include date and the pick out the description element rather than the first <p>
element within it.)
1 Like