質問編集履歴
3
追加で試したことを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -65,3 +65,21 @@
|
|
65
65
|
```
|
66
66
|
|
67
67
|
インデックス数を取得する処理部分ももう少しスマートにできる気がしますが、それについては元の質問に対して回答してあげてください。
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
###追加で試したこと
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
// こちらは失敗しない
|
76
|
+
|
77
|
+
UrlFetchApp.fetch('https://google.co.jp/');
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
// こちらは失敗が多い
|
82
|
+
|
83
|
+
UrlFetchApp.fetch('https://www.google.co.jp/search?hl=ja&q=site:google.com');
|
84
|
+
|
85
|
+
```
|
2
本文でGoogle Apps Scriptとわかるように追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
###前提・実現したいこと
|
2
2
|
|
3
|
-
UrlFetchApp.fetch でGoogleの検索結果を取得したい。
|
3
|
+
Google Apps ScriptのUrlFetchApp.fetch でGoogleの検索結果を取得したい。
|
4
4
|
|
5
5
|
|
6
6
|
|
1
URLの検索式の指定に"site:"を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
function getDomainIndex(domain) {
|
48
48
|
|
49
|
-
var response = UrlFetchApp.fetch('https://www.google.co.jp/search?hl=ja&q='+domain);
|
49
|
+
var response = UrlFetchApp.fetch('https://www.google.co.jp/search?hl=ja&q=site:'+domain);
|
50
50
|
|
51
51
|
var content = response.getContentText();
|
52
52
|
|