0
私はPythonが新聞サイトをこすり、さまざまなHTMLタグを削除した後に、テキスト内の実際の物語を収集するために使用しています
import urllib.request
from bs4 import BeautifulSoup
#targetURL = 'http://indianexpress.com/article/india/mamata-banerjee-army-deployment-nh-2-in-west-bengal-military-coup-4405871'
targetURL = "http://timesofindia.indiatimes.com/india/Congress-Twitter-hacking-Police-form-cyber-team-launch-probe/articleshow/55737598.cms"
#targetURL = 'http://www.telegraphindia.com/1161201/jsp/nation/story_122343.jsp#.WEDzfXV948o'
with urllib.request.urlopen(targetURL) as url:
html = url.read()
soup = BeautifulSoup(html,'lxml')
for el in soup.find_all("p"):
print (el.text)
を次のように
私の簡単なコードです
indianexpress.comのURLまたはtelegraphindia.comのURLにアクセスしているとき、コードはうまくいきます。私は、純粋なテキスト形式で、迷惑なことなく、物語を広げています。
私はこの自分好みブロッカーをバイパスし、ページを取得取得する方法We have noticed that you have an ad blocker enabled which restricts ads served on the site.
Please disable to continue reading.
:?timesofindia.comサイトは、adblockのダウンロードブロッカーを持っており、次のようにこの場合には、出力されているが
提案に感謝します