質問編集履歴
4
codeの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,15 +17,16 @@
|
|
17
17
|
```ここに言語名を入力
|
18
18
|
|
19
19
|
import requests
|
20
|
+
from bs4 import BeautifulSoup
|
21
|
+
|
20
22
|
cakes = []
|
21
23
|
urls = create_url(http)
|
22
24
|
for url in urls:
|
23
25
|
r = requests.get(url)
|
24
26
|
bs =BeautifulSoup(r.text,'lxml')
|
25
27
|
contents = bs.find_all('div',class_='Menu')
|
26
|
-
|
27
28
|
for content in contents:
|
28
|
-
|
29
|
+
cake_name = content.find('div',class_='cake').find('a')
|
29
|
-
|
30
|
+
cakes.append(cake_name.text)
|
30
31
|
|
31
32
|
```
|
3
codeの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,65 +1,31 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
```ここに言語を入力
|
3
|
-
|
3
|
+
cakes = []
|
4
|
-
messages = []
|
5
|
-
companys = []
|
6
|
-
links = []
|
7
4
|
```
|
8
|
-
この
|
5
|
+
このリストの中身を重複しないようにしたい。
|
9
6
|
どのような書き方があるのか知りたいです。
|
10
7
|
|
8
|
+
前回のコードは、規約違反でしたので削除しました。
|
9
|
+
指摘ありがとうございました。
|
11
10
|
|
12
11
|
|
13
12
|
|
13
|
+
|
14
|
+
|
14
15
|
### 該当のソースコード
|
15
16
|
|
16
17
|
```ここに言語名を入力
|
17
|
-
def create_url(words,live,pages):
|
18
|
-
urls = []
|
19
|
-
pages = int(pages)
|
20
|
-
_url = 'https://jp.indeed.com/jobs?q={}%E3%80%80&l={}&start='.format(words,live)
|
21
|
-
for i in range(10,(pages*10)+10,10):
|
22
|
-
url = _url+'{}'.format(i)
|
23
|
-
urls.append(url)
|
24
|
-
return urls
|
25
18
|
|
19
|
+
import requests
|
20
|
+
cakes = []
|
26
|
-
|
21
|
+
urls = create_url(http)
|
22
|
+
for url in urls:
|
23
|
+
r = requests.get(url)
|
24
|
+
bs =BeautifulSoup(r.text,'lxml')
|
25
|
+
contents = bs.find_all('div',class_='Menu')
|
27
26
|
|
28
|
-
import requests
|
29
|
-
from bs4 import BeautifulSoup
|
30
|
-
|
31
|
-
titles = []
|
32
|
-
messages = []
|
33
|
-
companys = []
|
34
|
-
links = []
|
35
|
-
scheme='https://jp.indeed.com/'
|
36
|
-
|
37
|
-
urls = create_url(words,live,pages)
|
38
|
-
for
|
27
|
+
for content in contents:
|
39
|
-
r = requests.get(url)
|
40
|
-
bs =BeautifulSoup(r.text,'lxml')
|
41
|
-
|
28
|
+
title = content.find('div',class_='cake').find('a')
|
29
|
+
titles.append(title.text)
|
42
30
|
|
43
|
-
for content in contents:
|
44
|
-
title = content.find('div',class_='title').find('a')
|
45
|
-
titles.append(title.text)
|
46
|
-
|
47
|
-
message = content.find('div',class_='summary')
|
48
|
-
messages.append(message.text)
|
49
|
-
|
50
|
-
company = content.find('div',class_='sjcl').find('span',class_='company')
|
51
|
-
companys.append(company.text)
|
52
|
-
|
53
|
-
link = scheme+content.find('a').get('href')
|
54
|
-
links.append(link)
|
55
|
-
|
56
|
-
return titles,messages,companys,links
|
57
|
-
|
58
|
-
def job_printer(word,live,pages):
|
59
|
-
titles,messages,companys,links = job_search(word,live,pages)
|
60
|
-
print('\n\n')
|
61
|
-
print('{}社見つかりました。\n\n 検索ワード:{}\t所在市:{}\tページ数:{}'.format(len(companys),word,live,pages))
|
62
|
-
for i in range(len(messages)):
|
63
|
-
print(titles[i],'\n',messages[i],'\n',companys[i],'\n',links[i])
|
64
|
-
print('\n\n')
|
65
31
|
```
|
2
codeの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -32,7 +32,6 @@
|
|
32
32
|
messages = []
|
33
33
|
companys = []
|
34
34
|
links = []
|
35
|
-
checkbox = []
|
36
35
|
scheme='https://jp.indeed.com/'
|
37
36
|
|
38
37
|
urls = create_url(words,live,pages)
|
@@ -40,16 +39,8 @@
|
|
40
39
|
r = requests.get(url)
|
41
40
|
bs =BeautifulSoup(r.text,'lxml')
|
42
41
|
contents = bs.find_all('div',class_='jobsearch-SerpJobCard')
|
43
|
-
|
44
|
-
|
42
|
+
|
45
|
-
_messages = ''
|
46
|
-
_companys =''
|
47
|
-
_links = ''
|
48
|
-
_checkbox = []
|
49
|
-
|
50
43
|
for content in contents:
|
51
|
-
if content not in checkbox:
|
52
|
-
_checkbox.append(content)
|
53
44
|
title = content.find('div',class_='title').find('a')
|
54
45
|
titles.append(title.text)
|
55
46
|
|
@@ -61,17 +52,14 @@
|
|
61
52
|
|
62
53
|
link = scheme+content.find('a').get('href')
|
63
54
|
links.append(link)
|
64
|
-
|
65
|
-
|
55
|
+
|
66
|
-
titles.append(_titles)
|
67
|
-
messages.append(_messages)
|
68
|
-
companys.append(_companys)
|
69
|
-
links.append(_links)
|
70
|
-
|
71
56
|
return titles,messages,companys,links
|
72
|
-
```
|
73
57
|
|
58
|
+
def job_printer(word,live,pages):
|
59
|
+
titles,messages,companys,links = job_search(word,live,pages)
|
74
|
-
|
60
|
+
print('\n\n')
|
75
|
-
|
76
|
-
|
61
|
+
print('{}社見つかりました。\n\n 検索ワード:{}\t所在市:{}\tページ数:{}'.format(len(companys),word,live,pages))
|
77
|
-
|
62
|
+
for i in range(len(messages)):
|
63
|
+
print(titles[i],'\n',messages[i],'\n',companys[i],'\n',links[i])
|
64
|
+
print('\n\n')
|
65
|
+
```
|
1
codeの修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
listに重複が無いように追加していきたい。
|
body
CHANGED
File without changes
|