java


How to parse the Google search result in a specific date range?


To set the search result only in a range of date , there are 2 ways of method :
1) Adding the google search keyword with google search operator
&
2) Modelling the url(adding the suffix) .
In my Java application ,I would like to scrape the google news search results (links & title) in a specific range of date by JSOUP ,like 2016
However , I tried this 3 ways of method ,none of them is successful (contain non-2016 results) .Even through I tired this 3 method in google search box (google web site) or adding the url suffix,they cannot spot the 2016 results .
How to fix this?
By adding google search keyword:
String search = "stackoverflow daterange:2016-01-01..2016-12-31"
String search = "stackoverflow daterange:2457389-2457735"
Adding url:
+"&tbs=cdr%3A1%2Ccd_min%3A1%2F1%2F2016%2Ccd_max%3A12%2F31%2F2016"
Code:
String google = "http://www.google.com/search?q=";
String search = "stackoverflow daterange:2016-01-01..2016-12-31 "; //using the google search operators (daterange)
String charset = "UTF-8";
String news="&tbm=nws";
String string = google + URLEncoder.encode(search , charset) + news;
String userAgent = "ExampleBot 1.0 (+http://example.com/bot)";
System.setProperty("http.proxyHost", "192.168.5.1");
System.setProperty("http.proxyPort", "1080");
for(int j=0;j<3;j++){
Document document = Jsoup.connect(string+"&start="+(j+0)*10).userAgent(userAgent). ignoreHttpErrors(true).followRedirects(true).timeout(100000).ignoreContentType(true).get();
Elements links = document.select( ".r>a");
....}

Related Links

How can I close a Java application from another Java application?
Convert MySQL db to embeddable database for Java jdbc
What happens to the threads in a class if you reinitialize the class?
sonarqube process[es] failed to start on Ubuntu
How can I reuse a library in multiple WAR/EAR files deployed on an application server?
Java httpServer basic authentication for different request methods
How to “ellipsize” the title of a AlertDialog in the middle? [duplicate]
is “content://” in the Uri of Content Provider in Android replaceable ?
Batik copy element from one document to another
Is Oracle db able to compare timestamps with different timezones?
Text selection in CCombo
how to sort non-english strings?
Java listeners - Mouse left-press not registering while typing
A one-liner to selectively include modules within an Android project at build-time?
Orika Mapping to JAXBElement<>
(Guice) Extending singleton class makes seperate lists

Categories

HOME
vbscript
atom-editor
heroku
youtube-dl
infragistics
c#-2.0
ckeditor
qore
medical
gitpitch
facebook-php-sdk
task
carthage
lombok
django-admin
apache-metamodel
http-status-code-504
firefox-webextensions
swingx
sox
smb
one-to-many
spark-jobserver
dynamic-featured-image
info.plist
typo3-6.2.x
ping
uiswipegesturerecognizer
gammu
mpmediaquery
event-driven
streamsets
sharefile
theano.scan
vapor
document.write
powershell-dsc
netcdf4
btrace
galleria
jsch
winscp-net
setter
directory-structure
sqlclient
titanium-android
dwscript
xcb
qcustomplot
cloudbees
unity-networking
prerequisites
teamcity-8.0
ora-00900
comobject
fouc
rgeo
iiviewdeckcontroller
system32
dundas
unity5.2.3
typekit
coldbox
android-imagebutton
elliptic-curve
phpthumb
rebol3
resty-gwt
message-driven-bean
cloud-connect
openlaszlo
google-cloud-save
excel-2003
dmoz
unc
gil
ocx
custom-backend
fireworks
vdsp
krl
imac
gallio
dmx512
revisions
rescale
multi-tier
substrings
kdbg
libs

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App