2
を持つクラス内のタグを選択:私は、HTMLのこの部分のhrefを取得しようとしているBS4
<h3 class="post-title entry-title" itemprop="name">
<a href="http://sslproxies24.blogspot.it/2016/10/01-10-16-free-ssl-proxies-1070.html">01-10-16 | Free SSL Proxies (1070)</a>
</h3>
は、だから私はこのスクリプトを作成しました:
import urllib.request
from bs4 import BeautifulSoup
url = "http://sslproxies24.blogspot.it/"
soup = BeautifulSoup(urllib.request.urlopen(url))
for tag in soup.find_all("h3", "post-title entry-title"):
links = tag.get("href")
しかし、リンク、」doesnの何かを見つける。
print (tag.attrs)
です:
実際の出力はので、私はBS4で選択したクラス「ポストタイトルのエントリーのタイトルは」、「HREF」を属性れていません...です
{'itemprop': 'name', 'class': ['post-title', 'entry-title']}
"a"要素を選択してhrefでリンクを取得するにはどうすればよいですか?
私は本当に感謝します!出来た! – CatchJoul