A.AY adlı üyeden alıntı: mesajı görüntüle
link
https://www.youtube.com/watch?v=oqyangMGVjA
Gizli video
yazısını çekmek istiyorum. Normal BeautifulSoup ile yapamadım.
Birde BeautifulSoup Xpath ile yapayım dedim.

from bs4 import BeautifulSoup
from lxml import etree
import requests
  
  
headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'
}

response = requests.get("https://www.youtube.com/watch?v=oqyangMGVjA", headers=headers)
soup = BeautifulSoup(response.content, "html.parser")
dom = etree.HTML(str(soup))
print(dom.xpath('//*[@id="reason"]')) # Boş değer döndürüyor
ilgili veri JavaScript ile yükleniyor.

html body içerisinden json verisini alıp onu ayrıştırmanız gerekli