###実現したいこと、発生している問題
社内環境下でwebページ(ロイター記事)のタイトルおよび記事内容のスクレイピングを行いたく、下記のソースコードを書きました。
実行したところ、
<title>記事タイトル</title> <description>[東京 XX日 ロイター] 記事本文 <div class="feedflare"><a href="http://以下省略</description>と表示されました。
<title>や</title>、 <description>や<div class="feedflare"><a href="http://以下省略</description> といった部分を取り除いて抽出する場合、どのように加筆修正すれば良いでしょうか。初歩的な質問で恐縮ですが、ご教示いただけますでしょうか。
なお、windows7、Internet Explorer(google chromeは使えません)、python3.6.1を使用しています。
###該当のソースコード
import requests
from bs4 import BeautifulSoup
proxies = {'http':'http://user:password@server:port'}
def getBS(url):
html = requests.get(url, proxies=proxies)
bsObj = BeautifulSoup(html.content, "html.parser")
return bsObj
htmlSource = getBS("http://feeds.reuters.com/reuters/JPBusinessNews")
for link in htmlSource.findAll("item"):
print(link.find("title"))
print(link.find("description"))

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/08/09 08:32
2017/08/09 09:02
2017/08/09 09:53
2017/08/09 23:26