模板:YouTube
| File:Ambox important.svg | 請不要使用此模板連結到違反著作權法的材料。 如果連結這種材料,則必須使用合乎著作權的連結替代或者立即刪除。 |
| 警告 | 此模板被參照於約18,000個頁面。 為了避免造成大規模的影響,所有對此模板的編輯應先於沙盒、測試樣例或您的沙盒上測試。 測試後無誤的版本可以一次性地加入此模板中,但是修改前請務必於討論頁發起討論。 模板參照數量會自動更新。 |
本模板用作==外部連結==章節連結YouTube影片的外部連結。此模板並非參考來源模板,您可以使用{{cite AV media}}參照影音媒體。對於連續劇或連載式的媒體,使用{{cite episode}}或{{cite serial}}。要參照唱片封套上的說明文字(liner notes)及其他配有影音媒體的平面媒體,請使用{{cite AV media notes}}。
用法[編輯]
連結至影片[編輯]
{{YouTube|视频id|link=no|视频描述|h=小時數|m=分鐘數|s=秒數|language=語言}}
- 參數說明:
- 參數 1:影片id,即是在
http://www.youtube.com/watch?v=或https://music.youtube.com/watch?v=之後的YouTube id,須符合d:Property:P1651#P2302的格式約束規定:64位元整數的Base64編碼,即符合以下的正則表達式:[-_0-9A-Za-z]{11}(即11個字元的半形的連字暨減號、下橫線、阿拉伯數字、不區分大小寫的英文字母)- 例如:https://www.youtube.com/watch?v=7bvukR-332A ,那麼影片id便是
7bvukR-332A。
- 例如:https://www.youtube.com/watch?v=7bvukR-332A ,那麼影片id便是
- 參數 2(可省略):為影片給出了一個可選的描述。
- 若省略此參數則描述會是包含本模板的頁面名稱。
- h(可省略):影片要開始播放的小時數。若省略此參數則為0。
- m(可省略):影片要開始播放的分鐘數。若省略此參數則為0。
- s(可省略):影片要開始播放的秒數。若省略此參數則為0。(注意:參數show不可用簡稱s,否則會與秒數衝突而無法正常顯示。)
- language(可省略):影片的語言。
- link=no(可省略):用於取消YouTube條目連結。(此參數目前沒有效果。)
- 參數 1:影片id,即是在
範例[編輯]
{{Youtube|PfcgWfKOp1g}}- 效果:YouTube上的影片
{{YouTube|9bZkp7q19f0|《江南Style》}}{{YouTube|c=UCidwPAdN3UO59sMOZX2cn6Q}}{{YouTube|show=startrek|''Star Trek: The Original Series''}}{{Youtube|PfcgWfKOp1g|Varias.Macau 85/86|m=3}}- 效果:YouTube上的Varias.Macau 85/86,始於3分00秒
{{Youtube|PfcgWfKOp1g|Varias.Macau 85/86|m=3|s=04}}- 效果:YouTube上的Varias.Macau 85/86,始於3分04秒
{{Youtube|PfcgWfKOp1g|Varias.Macau 85/86|m=3|s=04|language=zh-hk}}- 效果:YouTube上的Varias.Macau 85/86,始於3分04秒(繁體中文)
連結至用戶頻道[編輯]
{{YouTube|user=userchannelname|title}}
- 參數 user:填入「YouTube 用戶頻道名」,像是
https://www.youtube.com/user/userchannelname - 可以使用簡寫 u 指定,即
{{YouTube|u=userchannelname|title}}
{{YouTube|channel=userchannelid|title}}
- 參數 channel:填入「YouTube 用戶頻道id」,像是
https://www.youtube.com/channel/userchannelid,該參數須符合d:Property:P2397#P2302的格式約束規定:須符合以下的正則表達式:UC[-_0-9A-Za-z]{21}[AQgw] - 可以使用簡寫 c 指定,即
{{YouTube|c=userchannelid|title}}
{{YouTube|custom=yourcustomname|title}}
- 參數 custom:填入「YouTube 自訂網址name」,像是
https://www.youtube.com/c/yourcustomname。
{{YouTube|handle=userhandlecode|title}}
- 參數 handle:填入「YouTube 帳戶代碼」,像是
https://www.youtube.com/@userhandlecode - 可以使用簡寫 @ 指定,即
{{YouTube|@=userhandlecode|title}}
連結至影片清單[編輯]
{{YouTube|playlist=playlistid|title}}
- 參數 playlist:填入「YouTube播放清單id」,像是
https://www.youtube.com/playlist?list=playlistid,該參數須符合d:Property:P4300#P2302的格式約束規定:須符合以下的正則表達式:EL[0-9A-Za-z_-]{10}[048AEIMQUYcgkosw]||PL[0-9A-Za-z_-]{16}|(?:UU|UC|PL|LL|EL)[0-9A-Za-z_-]{21}[AQgw]|PL[0-9A-Za-z_-]{32}|(?:OLAK5uy_|RDCLAK5uy_)[0-9A-Za-z_-]{32}[048AEIMQUYcgkosw] - 可以使用簡寫 p 指定,即
{{YouTube|p=playlistid|title}}。 - 參數 title 是可選的描述,如不提供則為當前條目標題名稱(PAGENAME)。
模版數據[編輯]
<templatedata> { "description": "本模板用以在外部連結段落建立連結至YouTube網站的超連結。非參考來源模板。", "params": { "id": { "label": "YouTube 影片ID", "description": "影片ID是網址 https://www.youtube.com/watch?v=[影片ID] 之處", "aliases": [ "1" ], "example": "9bZkp7q19f0", "type": "string" }, "user": { "label": "YouTube 用戶名", "description": "YouTube 用戶名是在網址 https://www.youtube.com/user/[用戶名] 之處", "aliases": [ "u" ], "example": "pewdiepie", "type": "string" }, "channel": { "label": "YouTube 頻道ID", "description": "YouTube 頻道ID是在網址 https://www.youtube.com/channel/[頻道ID] 之處", "aliases": [ "c" ], "example": "UC-9-kyTW8ZkZNDHQJ6FgpwQ", "type": "string" }, "custom": { "label": "YouTube 自訂頻道ID", "description": "YouTube 自訂頻道ID是在網址 https://www.youtube.com/c/[自訂網址name] 之處", "example": "YouTubeCreators", "type": "string" }, "show": { "label": "YouTube 節目名稱", "description": "YouTube 節目名稱在網址 https://www.youtube.com/show/[showname] 之處", "example": "startrek", "type": "string" }, "playlist": { "label": "YouTube 播放清單ID", "description": "YouTube 播放清單ID是在網址 https://www.youtube.com/playlist?list=[播放清單ID] 之處", "aliases": [ "p" ], "example": "PLrEnWoR732-DZV1Jc8bUpVTF_HTPbywpE", "type": "string" }, "title": { "label": "Title", "description": "The name of the page being linked to", "suggested": true, "aliases": [ "1", "2" ], "example": "Gangnam Style", "default": "If it is a video, Video, if it is a show, the article's page name in italics, otherwise, the article's page name unformatted", "type": "string" }, "link": { "label": "Link on", "description": "Set this parameter to no to suppress the link to the YouTube article", "example": "no", "type": "string" }, "handle": { "aliases": [ "@" ], "label": "YouTube 帳號代碼", "description": "YouTube 帳號代碼是在網址 https://www.youtube.com/@[帳號代碼] 處", "example": "youtubecreators", "type": "string" } }, "paramOrder": [ "id", "user", "channel", "custom", "handle", "show", "playlist", "title", "link" ] } </templatedata>