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 to return SeekBar value to previous activity?
Special Characters with MYSQL JAVA Netbeans and JXL
Unable to get this method to work [closed]
How to extract an email address which is not in a regular expression format from a span text using selenium web driver?
Spring boot health check on existing webapp
How to optimise java pattern replace
How to authenticate with rest webservice using oauth2
Starting ActiveMQ with Stomp
Customized selenium Output
Sending a large data by Post between servlets [duplicate]
Fetching the CA details from a x.509 certificate in Android
java - unique list of different objects with same fields (id, name, …)
Suite for pages in Fitnesse Java
Interoperability Azure Service Bus Message Queue Messages
db4o openfile file format incompatible
Swap numerals in a String by byte operation

Categories

HOME
ibm-bluemix
netbeans
c#-4.0
push-notification
tesseract
twitter-bootstrap-4
disassembler
ebean
blueprintjs
ezpublish
node-notifier
pheatmap
applepay
facebook-php-sdk
floating-action-button
quickbooks
orchardcms
visual-studio-2005
messages
hapi
telephony
evopdf
google-cloud-speech
shared-hosting
plunker
cx-freeze
mps
sylius
lcd
android-widget
wpfdatagrid
brunch
filezilla
fopen
windows-error-reporting
web-api-testing
maxmind
xacml
jspm
stormpath
binary-data
ioio
create-table
stringtemplate
windows-dev-center
asset-pipeline
picasso
neuroscience
event-driven
serverside-rendering
libvpx
bootstrapper
lumberjack
fedex
nxlog
unixodbc
scorm
cubic-spline
google-datalayer
azure-application-gateway
pango
pubmed
python-c-api
hendrix
yii2-extension
qtwebview
memory-alignment
zendesk-app
blacklist
eventkit
topbeat
messenger
visual-c++-2008
spring-android
instant
bonobo
contact-list
disque
react-native-listview
photobucket
wso2cloud
endeca-workbench
ibaction
e10s
system.reflection
gui-test-framework
wordpress-theme-customize
android-radiobutton
xceed-datagrid
ember-charts
html-editor
factory-method
dice
dbproviderfactories
qtkit
mercurial-server
spyware
lpeg
wise
getresponsestream
multi-tier
sef
simpletest
sector
3gp

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App