kcchung
kcchung@cs.nctu.edu.tw
python weather.py [-h] [-l location] [-u unit] [-a | -c | -d day | -s]
-h print help (2%)
-l locations (8%)
-u unit (3%)
-a equal to -c -d 5 (5%)
-c current condition (10%)
-d forecast (10%)
-s sunset/sunrise (2%)
Argument Check (10%)
unit and location configuration (10%)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# file: config.py
LOCATION=Hsinchu
UNIT=c
Hint: packages you might use
Hint: resources you might use
python youtube.py [-h] [-n] keyword
-h print help (2%)
-n number of search result. default is 5 (5%)
-p page that you parse (5%)
Output fields (10%)
{title} ({url})
{description}
Like: {number_of_like}, Dislike: {number_of_dislike}
For example:
勸世寶貝喵喵ㄉ喵電感應 (https://url.fit/ZA40H)
喵喵首張個人專輯"喵喵異次元" 好評發售中購買請洽勸世宗親會粉絲專頁&露天拍賣專區訂購 ...
Like: 6,483, Dislike: 2,914
Url Part
勸世寶貝喵喵ㄉ喵電感應 (https://www.youtube.com/watch?v=DDO_aCkivxU)
喵喵首張個人專輯"喵喵異次元" 好評發售中購買請洽勸世宗親會粉絲專頁&露天拍賣專區訂購 ...
Like: 6,483, Dislike: 2,914
勸世寶貝喵喵ㄉ喵電感應 (https://url.fit/ZA40H)
喵喵首張個人專輯"喵喵異次元" 好評發售中購買請洽勸世宗親會粉絲專頁&露天拍賣專區訂購 ...
Like: 6,483, Dislike: 2,914
Argument Check (8%)
jaychung@Utopi4 [01:56:20] [~/Desktop]
-> % python youtube.py 喵電感應 -n ad
usage: youtube.py [-h] [-n N] [-p P] keyword
youtube.py: error: argument -n: invalid int value: 'ad'
jaychung@Utopi4 [01:56:20] [~/Desktop]
-> % python youtube.py 喵電感應 -p abc
usage: youtube.py [-h] [-n N] [-p P] keyword
youtube.py: error: argument -p: invalid int value: 'abc'
Hint: packages you might use
urllib
How to call UrlFit shorten api?
GET https://developer.url.fit/api/shorten?long_url={your_long_url}
RETURN {'url': hash}
=> https://url.fit/{hash}
Before encode:
https://www.google.com.tw/#q=python+requests+encode+url
After encode:
https%3A%2F%2Fwww.google.com.tw%2F%23q%3Dpython%2Brequests%2Bencode%2Burl
GET https://developer.url.fit/api/shorten?long_url=https%3A%2F%2Fwww.google.com.tw%2F%23q%3Dpython%2Brequests%2Bencode%2Burl
.
├── config.py (optional)
├── weather.py
└── youtube.py
0 directories, 3 files
kcchung@cs.nctu.edu.tw