2
私は次のPythonスクリプトを書いて、特定の日付範囲内でGoogleニュース検索結果の見出しをクロールして掻き集める。スクリプトは機能していますが、リストに記載されている検索結果ではなく、最新の検索結果を表示しています。ウェブクロールGoogle - 別の結果を得る
など。むしろ2015年7月1日からの結果を示すより - 2015年7月7日、このスクリプトは
import urllib.request
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
#get and read the URL
url = ("https://www.google.co.in/search?q=banking&num=100&safe=off&espv=2&biw=1920&bih=921&source=lnt&tbs=cdr%3A1%2Ccd_min%3A01%2F07%2F2015%2Ccd_max%3A07%2F07%2F2015&tbm=nws")
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
html = opener.open(url)
bsObj = BeautifulSoup(html.read(), "html5lib")
#extracts all the links from the given page
itmes = bsObj.findAll("h3")
for item in itmes:
itemA = item.a
theHeading = itemA.text
print(theHeading)
誰かが日付順にソート望ましい結果を得るための正しい方法、に私を導いてくださいすることができ(今月)2016年5月からの結果を示しています?
ありがとうございます。
@Julien Salinasさん、ありがとうございます。感謝しています。 – chhibbz