LoginSignup
3
2

More than 3 years have passed since last update.

Qiitaでフォロー中のタグを全部指定した検索結果画面のURLを作るワンライナー

Last updated at Posted at 2021-01-19

はじめに

Qiitaのタグフィードの代わりにするやつ という記事の続きです。
いちいちQiitaのマイページからフォロー中のタグを調べてURL作るのが面倒なのでQiita APIを使ってワンライナーを書いてみました。

動作環境や注意点など

Linux Mint 19.3 (Ubuntu 18.04LTSベース)
curl,jqは追加でインストールする必要があるかもしれません。

  • QiitaAPIを使ってのフォロータグは1度に100個までしか取得できないので、100個を越えるフォロータグがある場合その対応が必要です。
  • アクセストークンを使っていないので1つのIPアドレスにつき1時間に60回の回数制限があります。アクセストークンを取得してそれを指定すればその制限は緩和されるので必要であればそのように変更してください。

出来上がったワンライナー

curl -sS 'https://qiita.com/api/v2/users/(ここにQiitaのユーザ名を入れてください)/following_tags?per_page=100' | jq -r .[].id | awk '{if(NR==1){url="https://qiita.com/search?q=tag%3A" $0}else{url=url "+OR+tag%3A" $0}};END{print url "&sort=created"}'

Linuxのデスクトップ環境であれば、コマンドライン末尾に| xargs xdg-openを追加するとダイレクトにブラウザでオープンすることができると思います。

curl -sS 'https://qiita.com/api/v2/users/(ここにQiitaのユーザ名を入れてください)/following_tags?per_page=100' | jq -r .[].id | awk '{if(NR==1){url="https://qiita.com/search?q=tag%3A" $0}else{url=url "+OR+tag%3A" $0}};END{print url "&sort=created"} | xargs xdg-open'

実行結果

出力結果をブラウザにコピペすれば検索結果画面が表示されると思います。

$ curl -sS 'https://qiita.com/api/v2/users/hidezzz/following_tags?per_page=100' | jq -r .[].id | awk '{if(NR==1){url="https://qiita.com/search?q=tag%3A" $0}else{url=url "+OR+tag%3A" $0}};END{print url "&sort=created"}'
https://qiita.com/search?q=tag%3AQiita+OR+tag%3ASyncthing+OR+tag%3APAM+OR+tag%3A自宅サーバー+OR+tag%3Afoxdot+OR+tag%3ASuperCollider+OR+tag%3Aansible_spec+OR+tag%3Aserverspec+OR+tag%3Afabric+OR+tag%3AStow+OR+tag%3ADocker+OR+tag%3Avimwiki+OR+tag%3AGitHub+OR+tag%3AGit+OR+tag%3AGhq+OR+tag%3Avimrc+OR+tag%3Afzf+OR+tag%3Aawk+OR+tag%3Ased+OR+tag%3Aシェル芸+OR+tag%3Amastodon+OR+tag%3AArduboy+OR+tag%3Apassword+OR+tag%3AKeePass+OR+tag%3Ataskwarrior+OR+tag%3AOpenBSD+OR+tag%3ACppUTest+OR+tag%3AAnsible+OR+tag%3Araspbian+OR+tag%3AEnglish+OR+tag%3Aサーバー管理+OR+tag%3AGo+OR+tag%3ARaspberryPi+OR+tag%3ATwitter+OR+tag%3AYAML+OR+tag%3Alifehack+OR+tag%3AWireshark+OR+tag%3AarchLinux+OR+tag%3AUbuntu+OR+tag%3AVirtualBox+OR+tag%3ACentOS+OR+tag%3Agame+OR+tag%3ATDD+OR+tag%3ATerminal+OR+tag%3AUNIX+OR+tag%3Acommand+OR+tag%3A開発環境+OR+tag%3Atmux+OR+tag%3ANetBSD+OR+tag%3AFreeBSD+OR+tag%3ALua+OR+tag%3APerl+OR+tag%3AC+OR+tag%3AC+++OR+tag%3AShellScript+OR+tag%3AVim+OR+tag%3ALinux+OR+tag%3A正規表現+OR+tag%3ASSH&sort=created

「tag:Qiita OR tag:Syncthing OR tag:PAM OR tag:自宅サーバー OR tag:foxdot OR tag:SuperCollider OR tag:ansible_spec OR tag:serverspec OR tag:fabric OR tag:Stow OR tag:Docker OR tag:vimwiki OR tag:GitHub OR tag:Git OR tag:Ghq OR tag:vimrc OR tag:fzf OR tag:awk OR tag:sed OR tag:シェル芸 OR tag:mastodon OR tag:Arduboy OR tag:password OR tag:KeePass OR tag:taskwarrior OR tag:OpenBSD OR tag:CppUTest OR tag:Ansible OR tag:raspbian OR tag:English OR tag:サーバー管理 OR tag:Go OR tag:RaspberryPi OR tag:Twitter OR tag:YAML OR tag:lifehack OR tag:Wireshark OR tag:archLinux OR tag:Ubuntu OR tag:VirtualBox OR tag:CentOS OR tag:game OR tag:TDD OR tag:Terminal OR tag:UNIX OR tag:command OR tag:開発環境 OR tag:tmux OR tag:NetBSD OR tag:FreeBSD OR tag:Lua OR tag:Perl OR tag:C OR tag:C OR tag:ShellScript OR tag:Vim OR tag:Linux OR tag:正規表現 OR tag:SSH」の検索結果 - Qiita

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2