質問編集履歴
3
図を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
まず、下記図の赤枠部分のテキストとURLを取得したいです。
|
24
24
|
|
25
|
-
[イメージ説明](
|
25
|
+
![イメージ説明](c9aa8a19174331c9a13544c75caa2b58.jpeg)
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
```ここに言語を入力
|
32
32
|
|
33
|
-
# -*- coding: utf-8 -*-
|
33
|
+
# -*- coding: utf-8 -*-
|
34
34
|
|
35
35
|
import scrapy
|
36
36
|
|
2
具体的な説明追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,11 +20,17 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
+
まず、下記図の赤枠部分のテキストとURLを取得したいです。
|
24
|
+
|
25
|
+
[イメージ説明](5905d9491734b713cf56ada7e855c815.jpeg)
|
26
|
+
|
27
|
+
|
28
|
+
|
23
29
|
###該当のソースコード(\shareshare\spiders\get_shareshare.py)
|
24
30
|
|
25
31
|
```ここに言語を入力
|
26
32
|
|
27
|
-
# -*- coding: utf-8 -*-
|
33
|
+
# -*- coding: utf-8 -*-!
|
28
34
|
|
29
35
|
import scrapy
|
30
36
|
|
1
コード編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,12 +30,6 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
#from shareshare.items import shareshareItem
|
34
|
-
|
35
|
-
#from scrapy.selector import Selector # 追加
|
36
|
-
|
37
|
-
|
38
|
-
|
39
33
|
class shareshareSpider(scrapy.Spider):
|
40
34
|
|
41
35
|
name = "share_share"
|
@@ -50,7 +44,7 @@
|
|
50
44
|
|
51
45
|
)
|
52
46
|
|
53
|
-
|
47
|
+
|
54
48
|
|
55
49
|
def parse(self, response):
|
56
50
|
|
@@ -61,18 +55,6 @@
|
|
61
55
|
article['title'] = sel.css("table > tbody > tr:nth-child(1) > td > div > h3 > a::text").extract_first()
|
62
56
|
|
63
57
|
article['url'] = sel.css("div.result-list > table > tbody > tr:nth-child(1) > td > div > h3 > a::attr('href')").extract_first()
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
#「グノシー」からのコピペ。次ページの遷移方法がわからずコメント化
|
68
|
-
|
69
|
-
#next_page = response.css("div.page-link-option > a::attr('href')")
|
70
|
-
|
71
|
-
#if next_page:
|
72
|
-
|
73
|
-
# url = response.urljoin(next_page[0].extract())
|
74
|
-
|
75
|
-
# yield scrapy.Request(url, callback=self.parse)
|
76
58
|
|
77
59
|
```
|
78
60
|
|