質問編集履歴

3

参考追加

2022/09/21 03:53

投稿

minato2000
minato2000

スコア10

test CHANGED
File without changes
test CHANGED
@@ -77,3 +77,6 @@
77
77
  }
78
78
  ```
79
79
 
80
+ ### 参考
81
+ https://qiita.com/ledsun/items/0965a60f9bdff04f2fa0#xpath-parse5
82
+

2

試したこと追加

2022/09/21 03:46

投稿

minato2000
minato2000

スコア10

test CHANGED
File without changes
test CHANGED
@@ -48,6 +48,14 @@
48
48
  + const items = select('//x:a', doc)
49
49
  ```
50
50
 
51
+ - 別のWebサイトでXPathの動作確認をしたが、「0個の要素が見つかりました」が表示された。
52
+ ```diff
53
+ - const url = 'https://gundamevolution.jp/news/'
54
+ + const url = 'http://example.com'
55
+
56
+ - const items = select('//x:a[contains(@class, "news-list__item")]', doc)
57
+ + const items = select('//x:a', doc)
58
+ ```
51
59
 
52
60
 
53
61
 

1

試したこと追加

2022/09/21 03:30

投稿

minato2000
minato2000

スコア10

test CHANGED
File without changes
test CHANGED
@@ -36,6 +36,12 @@
36
36
  ```
37
37
 
38
38
  ### 試したこと
39
+ - fetchで取得したHTMLに問題がないかを確認したが、ニュースのタイトルなどがout.htmlで確認出来たので問題ないと判断した。
40
+ ```diff
41
+ + const fs = require('fs');
42
+ + fs.writeFileSync('out.html', text)
43
+ ```
44
+
39
45
  - 簡単なXPathに置き換えてXPathの動作確認をしたが、「0個の要素が見つかりました」が表示された。
40
46
  ```diff
41
47
  - const items = select('//x:a[contains(@class, "news-list__item")]', doc)