ed2k_link_fetcher/

Christians-iMac:ed2k_link_fetcher chunrix$ cat fetch_ed2k_links.sh
#!/bin/bash

script_dir=$(cd "$(dirname "$0")";pwd)
echo $script_dir
cd "$script_dir"

#'curl.txt' for curl result
#'ed2k.txt' for ed2k download links
rm -rf ./curl.txt ./ed2k.txt
touch ./curl.txt ./ed2k.txt

#Get all ed2k links available.
read -p 'Pls input the URL which may contain ed2k download links: '
curl "$REPLY" > curl.txt
#User has to be paste page source into curl.txt file
#vi ./curl.txt
echo 'All links are shown below:\n'
grep ed2k curl.txt | grep 800 | awk -F\" '{ print $4 }' | tee ed2k.txt

open "/Applications/Thunder.app"

#copy all ed2k links into clipboard
pbcopy < ed2k.txt

applescript="$script_dir/autoThunder.applescript"
echo $applescript
osascript "$applescript"

#'link_num' gets mount of links
link_num=$(cat ed2k.txt | wc -l)

echo 'Total ed2k links available:' $link_num
Christians-iMac:ed2k_link_fetcher chunrix$ cat autoThunder.applescript
tell application "System Events"
tell application "Thunder" to activate
key code 45 using {command down}
delay 1
key code 9 using {command down}
key code 76
end tell

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章