質問編集履歴

1

大幅な書き換え

2019/09/03 06:02

投稿

__PORNO___
__PORNO___

スコア10

test CHANGED
@@ -1 +1 @@
1
- ChromedriverとBeautifulSoupを使ったスクレイピングで文字化けが起こる
1
+ Atom-runnerで日本語が文字化け
test CHANGED
@@ -1,41 +1,75 @@
1
- ###したいこ
1
+ ###時間が経つ文字化けする?
2
2
 
3
- Chromedriverでログイン処理をして会員専用のペジでhtml取得
3
+ 起動当初は正常に表示されるのですが、atomを起動してしばらくコ入力してから実行すると文字化けが起こります。
4
4
 
5
- BeautifulSoupでhtmlをたい
5
+ ###init.coffee style.less 設定しても治らな
6
+
7
+ 以下のようにinit.coffee style.lessを設定しても治りません
6
8
 
7
9
 
8
10
 
9
- ###発生している問題
11
+ ```init
10
12
 
11
- Chromedriverで該当ページに移った後、
13
+ # Your init script
12
14
 
13
- ```python
15
+ #
14
16
 
17
+ # Atom will evaluate this file each time a new window is opened. It is run
18
+
19
+ # after packages are loaded/activated and after the previous editor state
20
+
21
+ # has been restored.
22
+
23
+ #
24
+
25
+ # An example hack to log to the console when each text editor is saved.
26
+
27
+ #
28
+
29
+ # atom.workspace.observeTextEditors (editor) ->
30
+
31
+ # editor.onDidSave ->
32
+
15
- soup = BeautifulSoup(driver.page_source,"html.parser")
33
+ # console.log "Saved! #{editor.getPath()}"
34
+
35
+ process.env.PYTHONIOENCODING = "utf-8";
16
36
 
17
37
  ```
18
38
 
19
- このコードを実行し、その後、
39
+ ```style
20
40
 
21
- ```python
41
+ // style UI elements inside atom-text-editor
22
42
 
23
- titles = soup.select("cssセレクタ")
43
+ atom-text-editor .cursor {
24
44
 
25
- ```でデータを抽出しています。
45
+ // border-color: red;
46
+
47
+ }
26
48
 
27
49
 
28
50
 
29
- ```python
51
+ .atom-runner pre{
30
52
 
31
- for text in titles:
53
+ font-family: meiryo;
32
54
 
33
- print(text.string)
55
+ font-size: 14px;
56
+
57
+ }
34
58
 
35
59
  ```
36
60
 
37
- titlesをfor文して日本語を含む文字列を出力しますが、日本語がひし形に?の記号になっているようです
61
+ ※style.lessは長いの省略してます。
38
62
 
39
63
 
40
64
 
65
+ もちろん、ファイルは保存して終了し、Atomの再起動を行いました。
66
+
67
+
68
+
69
+ ###環境
70
+
71
+ Windows10
72
+
73
+ Python3.7.4
74
+
41
- ChromedriverとBeautifulSoupを使っている環境での文字化け対処が見つけれず困っています。お力をお貸しください。
75
+ WebDriverとBeautifulSoupなどを使って、スクレイピングを行っています。