#๐Ÿ”’ Trying to get mp3 of a youtube video with urllib

14 messages ยท Page 1 of 1 (latest)

hoary wharf
#

Hi guys, Im trying to download the audio(mp3) of a video on youtube using built-in module urllib but the problem is there's no html element with a href attribute that points to the resource, so how to find it??

Here's my code, I chose a python tutorial for the url:

from urllib.request import urlopen
import re

url = https://www.youtube.com/watch?v=kqtD5dpn9C8&t=2208s
page = urlopen(url)
html = page.read().decode("utf-8")
links = re.findall("https://.*\.mp3",html)

Here links is empty so no html element with http that points to the audio, what Im doing wrong?

shrewd palmBOT
#

@hoary wharf

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

cold tulip
#

!rule 5

shrewd palmBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

thorny timber
#

Downloading videos from youtube is against its ToS

hoary wharf
#

ahh sorry didnt know about that, Im a beginner

#

so I remove this post?

thorny timber
#

!close

cold tulip
#

use !close

hoary wharf
#

ok thx, again sorry

#

!close

shrewd palmBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.