Closed yoshimaa closed 9 years ago
Please show me source code that you tried.
Thank you,
this is code, but no return. Im new to JS,node.js.
'''javascript var client = require('cheerio-httpcli');
var keyurl = 'http://kusatsuonsen.net/wp-content/uploads/2008/07/dsc_7661.jpg'; var url = 'https://www.google.com/searchbyimage?&image_url';
// client.fetch(url, { q: word }, function (err, $, res, body) { client.fetch(url, keyurl, function (err, $, res, body) { if (err) { return console.error(err); }
var results = []; // 検索結果が個別に格納されている要素をループ $('#rso .g').each(function (idx) { // 各検索結果のタイトル部分とURL、概要を取得 var $h3 = $(this).find('h3'); results.push({ title: $h3.text(), url: $h3.find('a').attr('href'), description: $(this).find('.st').text() }); });
console.log(results); }); '''
how can i search from image file at google image search? thanks:)
Is something like this ?
var client = require('cheerio-httpcli');
var keyurl = 'http://kusatsuonsen.net/wp-content/uploads/2008/07/dsc_7661.jpg';
var url = 'https://www.google.com/searchbyimage';
client.fetch(url, { image_url: keyurl }, function (err, $, res, body) {
if (err) {
return console.error(err);
}
var results = [];
$('#rso .g').each(function (idx) {
var $h3 = $(this).find('h3');
results.push({
title: $h3.text(),
url: $h3.find('a').attr('href'),
description: $(this).find('.st').text(),
thumbnail: $(this).find('.th img').attr('src')
});
});
console.log(results);
});
Awesome!! thanks:)
but something is wrong with me... i wanna explain what is different. i found it a little while ago.
if i search image url from a head "WEB",in Japanese "ウェブ検索" , the result is what you show me with code.
on the other hand, if i search that from a head "IMAGE",in Japanese "画像検索", the rusult is different from "WEB" search.
if you could, please help me! thanks.
Perhaps this difference seems to be due to each google search algorithm. Sorry, but I do not know that detail. :cry:
maybe, i have to use googlebot and something like this. anyway, thank you,ketty1220! i appreciate you:)
first,thanks ktty1220:) i appreciate you.
i want to get image title & url from a image file with scraping.
I've looked around so long, but never resolve. this is a condition,not using "Google custom API". I searched some way, but i couldn't resolve yet.
please help me!!