Skip to content

Commit

Permalink
Merge pull request #48 from fkubota/feat/36-v210_readme
Browse files Browse the repository at this point in the history
Feat/36 v210 readme
  • Loading branch information
fkubota authored Jan 5, 2021
2 parents 910ee75 + 85cc62e commit 2304a76
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 40 deletions.
79 changes: 50 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
伝書フクロウという意味です。

## About Carrier Owl

<img src='./data/images/system.png' width='1000'>

前日のarxivから気になる論文にスコアを付けてslackに通知するシステムです。
Expand Down Expand Up @@ -42,21 +43,16 @@
<img src='./data/images/09.png' width='600'>
3. **webhook urlの取得**
- 特定のslackチャンネルに流すための準備を行います。
- incomming webhookの**webhook url**を取得してください。
- 参考サイト
- [公式](https://slack.com/intl/ja-jp/help/articles/115005265063-Slack-での-Incoming-Webhook-の利用)
- [紹介記事](https://qiita.com/vmmhypervisor/items/18c99624a84df8b31008)
- slack通知の時のアイコンが設定できますので、よければこれ使ってください。
- [icon](https://github.com/fkubota/Carrier-Owl/blob/master/data/images/carrier-owl.png)
<img src='./data/images/carrier-owl.png' width='50'>
3. **通知先の設定**
通知したいアプリケーションに応じて設定を行います。いくつでも設定可能です。
- Slackに通知する場合は[こちら](./docs/slack_setup.md)
- LINEに通知する場合は[こちら](./docs/line_setup.md)
4. **webhook urlの設定**
- step3で取得した `webhook url` を設定します。
- step3で取得した `webhook url`(または `line token`) を設定します。
- 手順
a. `settings` をクリック。
Expand All @@ -67,29 +63,45 @@
c. `New repository secret` をクリック。
d. Nameを `SLACK_ID` と入力。Valueを **step2** で取得した`webhook url`を貼り付けます。
d. Nameを `SLACK_ID`(または `LINE_TOKEN` ) と入力。Valueを **step2** で取得した`webhook url`(また `line token`)を貼り付けます。
<img src='./data/images/07.png' width='1000'>
e. 最後に`Add secret`をクリックして登録完了です。
5. **領域の設定**
- 通知させたいarxivの論文の領域を指定します。
- **(computer scienceの人はこの手順を飛ばしてstep8に進んでも構いません)**
- `computer science` なら `cs` などそれぞれに名前がついています。以下の手順で確認します。
- 手順
1. [arxiv.org](https://arxiv.org)にアクセス
2. 通知させたい領域の**resent**と書かれた部分をクリック。
<img src='./data/images/02.png' width='400'>
3. 遷移後のページのurlを見て、`list/`と`/recent`に囲われている文字列を使います。
- computer scienceの例: `https://arxiv.org/list/cs/recent`
- この場合、`cs` をこの後利用する。
4. `config.yaml` 内の、`subject` を3で取得した文字列に変更します。(デフォルトでは`cs`になっています。)
1. 以下の表から通知を受け取りたいsubjectを選択して、urlをクリックしてください。
| subject | category | url |
| ------------------------------------------ | -------- | ----------------------------------------- |
| Astrophysics | astro-ph | [url](https://arxiv.org/archive/astro-ph) |
| Condensed Matter | cond-mat | [url](https://arxiv.org/archive/cond-mat) |
| Physics | physics | [url](https://arxiv.org/archive/physics) |
| Mathematics | math | [url](https://arxiv.org/archive/math) |
| Nonlinear Sciences | nlin | [url](https://arxiv.org/archive/nlin) |
| Computer Science | cs | [url](https://arxiv.org/archive/cs) |
| Quantitative Biology | q-bio | [url](https://arxiv.org/archive/q-bio) |
| Quantitative Finance | q-fin | [url](https://arxiv.org/archive/q-fin) |
| Statistics | stat | [url](https://arxiv.org/archive/stat) |
| Electrical Engineering and Systems Science | eess | [url](https://arxiv.org/archive/eess) |
| Economics | econ | [url](https://arxiv.org/archive/econ) |
2. さらに細かい分類を確認します
- 以下の例は、subject = `cs` をクリックした場合です。`cs.AI` や `cs.CL` などが細かな分類になります。
<img src='./data/images/10.png' width='600'>
3. `config.yaml` 内の、`subject` を2で確認した文字列に変更します。
- デフォルトでは`cat:cs.*`になっています。これは、cs以下の小分類すべてを通知するという設定になります。
- **複数領域指定**
- 複数領域指定も可能です。以下のよう `OR` でつなぎます。
- ex1) `cat:cs.AI OR cat:cs.CV`
- ex2) `cat:physics.* OR cat:cs.*`
- ex3) `cat:physics.space-ph OR cat:cs.AI OR cat:q-bio.BM`
6. **キーワードの設定**
Expand Down Expand Up @@ -119,11 +131,20 @@
- ここまでの変更がmasterブランチに反映されていれば、これですべての設定が完了したことになります。次の通知タイミングでslackに通知されます。
9. **test**
- 試しに動かしてみたい場合は、`master` ブランチから `test-send-to-slack` ブランチを作成してください。`test-send-to-slack` ブランチが作られるとgithub actionsが走って問題なければ通知されるはずです。
- Actionsタブで様子を確認できます。
- github actions の `workflow_dispatch` を使って通知タイミングを待たずにいつでも実行することができます。
- Actionsタブでから、`Run workflow` をクリックすることでいつでも実行可能です。
<img src='./data/images/11.png' width='800'>
<img src='./data/images/08.png' width='800'>
## その他の設定
- **score threshold**
通知するスコアに閾値を設定することができます。`score >= scrore_threshold` を満たす論文のみ通知させることができま
す。 `config.yaml` 内の、`score_threshold` で設定できます(デフォルトは0になっています)。
## Thanks
- [hppさん](https://github.com/hppRC)のお力をお借りして、v2.0.0から `github` だけで動作するようになりました。ご協力ありがとうございました。
- [hppさん](https://github.com/hppRC)のPRにより、github actionsを使うことにより `github` だけで動作するようになりました。
- [wakamezakeさん](https://github.com/wakamezake)のPRにより、arxiv-apiを導入しました。
- [amagaeruさん](https://github.com/amagaeru1113)のPRにより、LINE通知機能を実装しました。
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# arxivの学問領域の指定
subject: 'cs.*'
subject: 'cat:cs.*'

# 検索キーワード
keywords:
Expand Down
Binary file modified data/carrier-owl.gvdesign
Binary file not shown.
Binary file added data/images/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/line/001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/line/002.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/images/system.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions docs/line_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**LINE通知導入手順**

1. LINE Notify(https://notify-bot.line.me/ja/) にアクセスし、ログイン

2. ページ右上にある自分の名前をクリックし、マイページに移動

3. マイページ下部でアクセストークン発行

- 下記ページで発行

<img src='../data/images/line/001.png' width='600'>

- 発行時、通知するトークルームを設定できるので同じトークルームに入っている複数名に通知可能

15 changes: 15 additions & 0 deletions docs/slack_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**webhook urlの取得**

特定のslackチャンネルに流すための準備を行います。

1. incomming webhookの**webhook url**を取得してください。
- 参考サイト
- [公式](https://slack.com/intl/ja-jp/help/articles/115005265063-Slack-での-Incoming-Webhook-の利用)

- [紹介記事](https://qiita.com/vmmhypervisor/items/18c99624a84df8b31008)

2. slack通知の時のアイコンが設定できますので、よければこれ使ってください。
- [icon](https://github.com/fkubota/Carrier-Owl/blob/master/data/images/carrier-owl.png)

<img src='../data/images/carrier-owl.png' width='50'>

19 changes: 9 additions & 10 deletions src/carrier_owl.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ def notify(results: list, slack_id: str, line_token: str) -> None:
word = result.words
score = result.score

text = f'''
\n score: `{score}`
\n hit keywords: `{word}`
\n url: {url}
\n title: {title}
\n abstract:
\n \t {abstract}
\n {star}
'''
text = f'\n score: `{score}`'\
f'\n hit keywords: `{word}`'\
f'\n url: {url}'\
f'\n title: {title}'\
f'\n abstract:'\
f'\n \t {abstract}'\
f'\n {star}'

send2app(text, slack_id, line_token)


Expand Down Expand Up @@ -171,7 +170,7 @@ def main():
yesterday = datetime.datetime.today() - datetime.timedelta(days=1)
yesterday_str = yesterday.strftime('%Y%m%d')
# datetime format YYYYMMDDHHMMSS
arxiv_query = f'{subject} AND ' \
arxiv_query = f'({subject}) AND ' \
f'submittedDate:' \
f'[{yesterday_str}000000 TO {yesterday_str}235959]'
articles = arxiv.query(query=arxiv_query,
Expand Down

0 comments on commit 2304a76

Please sign in to comment.