HackMD
    • Sharing Link copied
    • /edit
    • View mode
      • Edit mode
      • View mode
      • Book mode
      • Slide mode
      Edit mode View mode Book mode Slide mode
    • Note Permission
    • Read
      • Only me
      • Signed-in users
      • Everyone
      Only me Signed-in users Everyone
    • Write
      • Only me
      • Signed-in users
      • Everyone
      Only me Signed-in users Everyone
    • More (Comment, Invitee)
    • Publishing
    • Commenting Enable
      Disabled Forbidden Owners Signed-in users Everyone
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Invitee
    • No invitee
    • Options
    • Versions
    • Transfer ownership
    • Delete this note
    • Template
    • Save as template
    • Insert from template
    • Export
    • Google Drive Export to Google Drive
    • Gist
    • Import
    • Google Drive Import from Google Drive
    • Gist
    • Clipboard
    • Download
    • Markdown
    • HTML
    • Raw HTML
Menu Sharing Help
Menu
Options
Versions Transfer ownership Delete this note
Export
Google Drive Export to Google Drive Gist
Import
Google Drive Import from Google Drive Gist Clipboard
Download
Markdown HTML Raw HTML
Back
Sharing
Sharing Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
More (Comment, Invitee)
Publishing
More (Comment, Invitee)
Commenting Enable
Disabled Forbidden Owners Signed-in users Everyone
Permission
Owners
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Invitee
No invitee
   owned this note    owned this note      
Published Linked with
Like BookmarkBookmarked
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- tags: disinfo --- Build selenium / chromedrive server ===== 需求 from pm5: 要讓爬蟲透過 remote 到 chromedriver 進行爬蟲,需要兼顧安全性 相關的middleware: https://github.com/disinfoRG/ZeroScraper/blob/master/newsSpiders/middlewares.py#L67 Remote 到 chromedriver 本身不難,官方有相關的遠端連線教學 https://chromedriver.chromium.org/getting-started 重點應該是安全性,幾個做法 1. 掛一個 squid 正向代理 + passwd 在前面,目前我在 middleware 有看到 PROXY 的連線方式,可行性蠻高的 2. VPN ? 3. ---- 我會用第一種方法先建立 還沒寫完待補QQ > 看起來不錯⋯⋯ [name=pm5] > 我們的 middleware 用 proxy 的地方是 chromedriver <-> web site 這一段。這裡我們需要的是 selenium <-> remote webdriver server 這一段的安全性,避免 remote webdriver server 被人拿去用,所以不太一樣。 > > 我們這一段如果要用 proxy 接 + basic authentication,大概要 patch 一下 selenium.webdriver.remote.remote_connection [這附近](https://github.com/SeleniumHQ/selenium/blob/master/py/selenium/webdriver/remote/remote_connection.py#L95)的程式。 > > 比較麻煩的可能是 HTTPS,不太確定 webdriver client 端支援有沒有什麼問題(雖然看起來可以)。有 HTTPS 的話,那 API security 通常的作法會用 token 也是要 patch remote_connection,所以這方面差不多。 > > 另外用 tunneling/VPN 的方法好像有人[遇到過問題](https://github.com/SeleniumHQ/selenium/issues/5859#issuecomment-406367132)。其他人嘗試 HTTPS 的[經驗](https://github.com/SeleniumHQ/selenium/issues/5073#issuecomment-348750241)也可以參考看看。 > > 總之掛一個 proxy 的方式我覺得可以繼續嘗試看看⋯⋯真的很卡關的話那就鎖 IP 吧 XD > [name=pm5] ---- 更新一下環境套件 ``` sudo apt-get update -y sudo apt-get upgrade -y ``` 安裝 docker ``` #移除舊 docker sudo apt-get remove docker docker-engine docker.io #安裝 docker sudo apt install docker.io #啟動且開機自動啟動 sudo systemctl start docker sudo systemctl enable docker ``` 安裝 chrome ``` wget -c https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome-stable_current_amd64.deb # 如果安裝有錯誤的話 sudo apt-get install -f ``` 開一個專案資料夾放 chromedriver ``` mdkir /usr/share/node/chromedriver cd /usr/share/node/chromedriver npm install chromedriver # 需要安裝 libnss3 apt-get install libnss3 # 測試 npx chromedriver Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 9515 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. # 需要讓他背景執行,用 pm2 管理 ```

Import from clipboard

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lost their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.


Upgrade

All
  • All
  • Team
No template.

Create a template


Upgrade

Delete template

Do you really want to delete this template?

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

Sign in via GitHub

New to HackMD? Sign up

Help

  • English
  • 中文
  • 日本語

Documents

Tutorials

Book Mode Tutorial

Slide Example

YAML Metadata

Resources

Releases

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions

Versions

Upgrade now

Version named by    

More Less
  • Edit
  • Delete

Note content is identical to the latest version.
Compare with
    Choose a version
    No search result
    Version not found

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.