I am scraping a website and would like to get the content inside a specific tag.
The tag I'd like to get the content inside is: <pre class="js-tab-content"></pre>
Here is my code:
request = urllib.request.Request(url=url)
response = urllib.request.urlopen(request)
content = response.read().decode()
tab = re.findall(r'<pre class="js-tab-content">(.*?)</pre>', content)
print(tab)
When I print tab I get an empty list []
Here is the content I am searching in:
.... <pre class="js-tab-content"><i></i><span>Em</span> <span>D</span> <span>Em</span> <span>D</span>
Lift M
ac Cahir Og your face, brooding o'er the old disgrace
<span>Em</span> <span>D</span> <span>G</span>-<span>D</span>-<span>Em</span>
That black Fitzwilliam stormed your place and drove you to the Fern.
<span>Em</span> <span>D</span> <span>Em</span> <span>D</span>
Gray said victory was sure, soon the firebrand he'd secure
<span>Em</span> <span>D</span> <span>G</span>-<span>D</span>-<span>Em</span>
Until he met at Glenmalure, Feach Mac Hugh O'Byrne
Chorus:
<span>G</span> <span>D</span>
Curse and swear, Lord Kildare, Feach will do what Feach will dare
<span>G</span> <span>G</span>-<span>D</span>-<span>Em</span>
Now Fitzwilliam have a care, fallen is your star low
<span>G</span> <span>D</span>
Up with halbert, out with sword, on we go for by the Lord
<span>G</span> <span>G</span>-<span>D</span>-<span>Em</span>
Feach Mac Hugh has given his word: Follow me up to Carlow
From Tassagart ____to Clonmore flows a stream of Saxon Gore
Great is Rory Og O'More at sending loons to Hades.
White is sick and Lane is fled, now for black Fitzwilliams head
We'll send it over, dripping red, to Liza and her ladies
See the swords of Glen Imayle flashing o'er the English Pale
See all the children of the Gael, beneath O'Byrne's banners
Rooster of the fighting stock, would you let an Saxon cock
Crow out upon an Irish rock, fly up and teach him manners
</pre> ....
I do not see why this is returning an empty list instead of a string inside the list with the content inside.
I have looked around the internet for around a half an hour and couldn't find any help.
Sorry if I look stupid here, if it is so obvious!
Anyway, thanks in advance!