【謎底揭曉】在台灣丟一顆石頭都會打中瞎譯那話兒!
(那話兒:表示不正當或不雅的事。小說中常指人的性器官而言。也作「那樁兒」。)
繼教授譯者謝瑤玲把「現代的祕教者窮得很」(don't have two pennies to rub together)譯成「現代的祕教者並沒有兩根可以搓在一起的陰莖」(two penises),繼教授譯者賴慈芸把「等文稿定案後,再找譯者來翻譯也不遲。」(after the job is done, fetch the translator)譯成「翻完之後,不要給譯者留活口」(after the job is done, kill the translator)之後,實在很難找到可以與之匹敵的胡譯瞎譯,直到最近,為了研究中英譯者如何處理「共匪」的英譯,為了暸解中譯「共匪」對應的英文原文是啥,竟然發現無敵的「丟一顆石頭……打中他那話兒」!
原文/中譯對照如下,應該有足夠的上下文讓有興趣一探究竟的讀者瞧瞧這誤會是怎麼發生的,歸納三個原因:
* 譯者想像力過於旺盛、
* 恍神或不用心,見樹不見林、
* 對原文文法不夠暸解,態度不對而輕忽之。
首先,「丟一顆石頭」的原文是 lob one (發射一個那個東西),那個東西指什麼?從原文脈絡明顯指向前兩句才剛剛說過的 tactical nuclear bombs (戰術核子武器),即使不說「發射一顆戰術核彈」,嫌太累贅,至少要譯成「發射一顆核彈」。
核彈怎會變石頭?譯者顯然查字典或Google了一下,發現動詞 lob (丟、投擲、發射)和 stone 還蠻常一起出現吧?!就給它「丟一顆石頭」下去了,用這種方式理解英文是不行的,one 必須指涉出現過的名詞概念,不然,one 也有「一個人」之意,但顯然「投擲/發射一個人到廁所」根本見鬼,所以譯者可能採取「消去法」,認定這one一定是個「東西」不是人,但也輪不到「石頭」來當the one啊!
其次,「打中他那話兒」的原文是 make sure I hit it,這裡跟前述的 one 一樣,有一個代名詞 it,同樣的,譯者又是對文法不夠尊重,想像力旺盛,從廁所就聯想到男人的那話兒,於是 it 就譯成「his private parts」(他那話兒),準備千古流芳了!但是各位有沒有注意到這個「解法」的矛盾和問題?中文「他那話兒」有一個「他」,他只能代表人,那這個他指涉誰?原文完全沒有出現「他」。譯者該不會希望讀者可以看出他的用意:用擬人法的譬喻,借用「男廁裡,他的那話兒」表達「克里姆林宮的機要位置」?這未免太扯,不太可能吧!這個 it 也指剛剛提過的東西,就是男廁嘛!
建議改譯:
……他曾說自己想要「發射一顆核彈瞄準克里姆林宮的男廁,而且一定要擊中」。
感謝幾位網友參與猜謎遊戲,請自行比對看看你猜中了多少。
這個寧可發揮天馬行空的想像力,也不要按部就班遵循基本英文文法思考所導致的爆笑誤譯,跟賴教授「不要給譯者留活口」的驚世之語,頗有異曲同工之妙:兩人皆是「語不驚人誓不休」(這正好也是書名)!
這樁兒事得來的教訓:
1. 把心用在理解原文和文法,這是翻譯首要的基本功,沒有之一,沒有替代的捷徑。Cue 一下賴教授。
2. 想像力無法控制,很危險,一定要謹記你的角色在哪,不要逾矩。
3. 再好的譯者(如這位陳信宏,中文文筆極佳,我注意欣賞已久,算是英倫哲學才子作家Alan de Botton的「欽定」譯者)都必定有盲點,都一定會出包。所以,任何翻譯都應該找有能力對照原文審核者來過目一次。這是對台灣出版社最衷心的建議。
- - - - -
//Goldwater, in his heart, believed that he was right. Right about the waste and distaste of the “welfare state” the Johnson administration had built. Right about the need for absolute military strength in the face of Soviet expansion. Right about a foreign policy that would make George Bush’s look downright friendly.
高華德內心深信自己是對的。他認為詹森政府建立的「福利國家」不僅揮霍資源,而且令人厭惡;他認為美國面對蘇聯的擴張,必須建構絕對的軍事實力;而且,他心目中的外交政策強硬至極,與他相比,連小布希都顯得太過友善。
Yes, Goldwater was an extremist and proud of it. His Republican convention acceptance speech is best remembered for the line “I would remind you that extremism in defense of liberty is no vice.”
的確,高華德是個極端主義者,並且以此為傲。他在共和黨代表大會上發表的接受提名演說當中,最令人難忘的一句話就是:「提醒各位,為了捍衛自由而採行的極端主義並非壞事。」
On the subject of foreign policy he was crystal clear about where he would lead the nation. Simply put: leave the United Nations and never look back, break off all relations with the Soviet Union, and use tactical nuclear bombs to fight communists in Vietnam and other Commie strongholds. Not surprisingly, many of his proclamations during the campaign were outrageous. He was quoted as saying he’d like to “lob one into the men’s room of the Kremlin and make sure I hit it.”
在外交政策方面,他清楚表明自己將會把國家帶往什麼方向。簡單說,就是毫不留戀地退出聯合國,斷絕與蘇聯的一切關係,並且利用戰術核子武器攻打越共以及其他共匪巢穴。不出意料,他在選戰期間提出的許多宣言都令人震驚。據傳他曾說自己很想「丟一顆石頭到克里姆林宮的男廁裡,打中他那話兒」。
Small wonder Johnson’s only concern was the extent of the landslide to come. The Democrats quickly seized upon Goldwater’s “let’s nuke ’em when we have the chance” philosophy and came up with their own unofficial slogan to counter “In Your Heart You Know He’s Right.” Their retort: “In Your Guts You Know He’s Nuts.” It didn’t stop there. Bumper stickers appeared with “Goldwater for Halloween” and “Vote for Goldwater and Go to War.”
難怪詹森不怕落敗,只怕贏得不夠多。民主黨緊抓高華德「一有機會就用核彈炸翻他們」的想法,故意惡搞他的口號:「你心知肚明這傢伙瘋了。」不只如此,當時還出現了不少保險桿貼紙,內容包括:「一票投給高華德,天天都是萬聖節」或者「想上戰場,就選高華德」。
To top it all off, the Johnson advertising team created the famous “Daisy” commercial. It showed a little girl plucking petals from a daisy as a nuclear countdown ends in a huge mushroom cloud explosion. President Johnson’s voiceover was, roughly, “vote for me or God help us all.”
此外,詹森的宣傳團隊還攝製了著名的「雛菊」廣告。畫面上只見一名小女孩在核彈攻擊倒數的同時拔著一朵雛菊的花瓣,倒數結束後,隨即轟然出現爆炸後的巨大蕈狀雲。詹森總統的旁白大致上是說:「請投我一票,不然只好祈求上帝保佑了。」//
#對照原文審校翻譯不可少
「fetch up中文」的推薦目錄:
fetch up中文 在 我的ivf试管婴儿の日记 Facebook 的最讚貼文
从老公的角度看试管婴儿疗程
当一对夫妻要做 #IVF试管疗程时,做丈夫的应该用什么态度来面对?常常有网友告诉我说,我的老公精子不好,可是他还是不能戒烟戒酒,好不配合。要知道,不孕症不只是女人的责任,男人也是有责任。这篇文章,是以男人的角度出发,里面分享身为丈夫应该如何帮助太太一起度过疗程,文章是英文内容,是奥莉爸爸写的,奥莉爸不会中文。分享给大家😊
IVF Journey, A Husband’s Perspective
Hi all, before reading further I would like to say this is NOT an instruction or tips for IVF and hopefully readers will understand my poorly written English. This is my journey as a father of the IVF baby girl. Why am I sharing all this? It is because my wife had a Facebook page of her IVF journey at https://facebook.com/ivfjourney2015/ and she told me that majorities (not all but most) feedback indicate husband not supportive enough to commit into a journey of IVF. I’m not a true supportive husband either, least I made up my mind to make it happen.
Let’s start with “Why IVF?”
We went for a fertilization test and results with;
Husband: Teratospermia (Human language, sperm is weak for fertilization process)
Wife: Unexplained infertility (I think this is easy to understand, there is for the confirming reason for this result and we don’t go for further test after it because it will consumes too much time and money)
We married and planned to have children late 2011, both our ages were 37 in 2015 because of late marriage. My wife introduced IVF because she does not want to give up and feels regretful in future and so do I. Maybe because I did too many regretful things in the past, now I do not want this happened to my wife. At least I do it better then ignoring it.
Preparation for IVF
Financially, I know it will involve amount of 20k – 30k “Ringgit Malaysia” in the whole process depending on the situation and this is only one chance for me. I don’t have the money for a second attempt because I need to allocate funds for delivery if success.
Mentally, I do some studies/research on IVF. The whole journey took 50 days and in one of the process my wife needs to do a self-injection daily. I quickly asked my wife “Daily injection?! Do I need to fetch you to clinic daily to do this?” She answered “No, we need to do this ourselves”. A final question from me going to be “How?!” After we sat down and discuss, we comes into conclusion and I will do the injection for her. This was the most painful and nervous moment I ever experience by poking a needle to my wife’s belly EVERYDAY!
Lifestyle, 6 months earlier. My wife told me the NO’s, NO alcohol NO smoking NO midnight wandering NO stress. I said, I will fly up to the skies like butterfly if I able to do all the NO’s. It’s like a mission impossible. How can a man like me not go out to social with friends without alcohol and smoke? The joke was sleeping early! You want me to social with my friends in breakfast or lunch time? At this time, she softly said “I really wants to have a cute baby in future, it looks more like a family. Furthermore, I don’t want to have regretful moments in future”. All these words came out of my love (wife), her words melted in my heart deeply. I told her “Ok, we will go for it BUT you will need to promise me ONE IMPORTANT thing. No matter the process success or not we only have one attempt we need to accept the truth and live happily without regret in future.” she agreed.
Commitment, this is not some empty promise. I made a huge commitment to change my lifestyle into zero alcohol, tobacco and lesser stress. If comparing the pain and suffers my wife will take in this journey e.g., injection, medication effects, hormone changes and all the effects from pregnancies to delivery, mine looks more alike small potatoes (looks much more simple). Trust me guys, don't compare it, if you do and more likely you're going loose badly. For the sake of making a better future, I had fulfilled this commitment.
IVF Journey Phase 1 “Unskilled Husband Injection”
Day 1, doctor consults us for Buserelin injection. I need to inject this medication into my wife's belly each day sharp at 8AM. The nurse had guided me side by side to do the first injection.
Day 2, I started my first injection to my wife's belly without anyone guiding beside. Feels a bit nervous because this time I'm doing it all by myself. I try to hum some music to distract my wife's from looking at the needle while injecting but still she is looking at it.
Day 3 - Day 15, sometime the injection hurting and causes bleeding/bruise to her. I need to find a new spot to inject every time and sees her bruise makes my pain in the heart too. My injection skills improved dramatically. She even told me that she doesn't feel pain like the beginning stages.
Day 16, follow up 2nd checkup. Doctor said, everything goes smoothly and added another medication to inject called Gonal-F to take home and start injecting on day 23. This message never surprises me because I've been told earlier, but just that the price to pay for this medication is quite costly.
Day 17 - Day 22, nothing much on these days and we just stick on the plan as usual.
IVF Journey Phase 2 “Stressful Night”
Day 23, Gonal F injections start today. This needle doesn't look same as those earlier, it comes with medication in it and look like a pen.
Day 24 - Day 26, side effects of the Gonal F medications started. My wife is feeling irritation at the injection site, fullness, bloating and tenderness in the lower abdomen due to the increasing size of the ovaries. Her mood changes dramatically as I can tell, but she endures it and tell me she can handle it.
Day 27, follow up 3rd checkup. Doctor said wife has eggs total of 12 and is ready for Transvaginal oocyte retrieval "Human language, Egg retrieval" at day 31.
Day 28 - Day 29, final injection of Gonal F. At day 29 night, I inject Ovidrel to wife belly to that causes the growth and release of a mature egg (ovulation) for day 31.
Day 30, resting whole day. Finally, we had a day without injection and worrying about holding any needles. Today we wondering about the egg growth, not knowing will the eggs grow more or still the same amount of 12.
Day 31, egg retrieval. 8 egg success retrieves and I give out my sperm for oocytes selection on the same day. Wife given cyclogest for oval protection after the egg retrieval.
IVF Journey Phase 3 “Hopeful Embryo Culture & Embryo Transfer”
Day 32 - Day 35, rest at home. We had pillow talk every night concerning about the growth of an embryo. We also look at sample growth stages of an embryo from the web to see what the current growth stage is.
Day 36, another hopeful and nervous morning. Doctor tells us the result of embryo culture as below;
Total Embryo Retrieve: 8
Embryo Qualified for ICSI: 6
Embryo Success until Cleavage Stage (Day 2 – Day 4): 3
Embryo Success until Blastocyst Stage (Day 5): 2
Embryo Qualified / Recommended for Transfer: 1
Both our eyes looked at each other, knowing only 1 Blastocyst Embryo available to transfer and doctor tell the same after it. I really do not know how to express both our feelings into words here, as we expected to have at least 2 Blastocyst out of 8 embryos and only left 1. We both agreed to proceed this only 1 Blastocyst transfer as this is the only choice we had. It's more likely walking on a 100ft tall string with no supports mission, a single error will fail the mission.
After the transfer process, wife given a room to rest for few hours. A nurse came and give us adjunctive medications, injections and advice while resting at room.
IVF Journey Phase 4 “The Final Moment of IVF”
Day 37 - Day 49, after the transfer. This period is known as 2WW (2 Weeks Wait) with adjunctive medications, injections and be very careful. I just let her sleep/rest more on the bed, I served her every meal in the room. We're also nervous and curious about pregnancy results on day 44, we tested with cheap pregnancy tester and get got a double line on it and we do have a little hope and joy with this result. On day 47, again we test, but this time with expensive pregnancy tester and the results double line again! We're so hopeful and happy at this moment. We really hope this result is true until the next checkup.
Day 50, final checkup. My wife goes for the hCG test by giving a sample of blood, we waited 2 hours for the results. While waiting, nurse guide us to a room to rest. Wife slept and I sat beside concerned on the hCG test results. 2 hours later, the doctor invited us to look for him. Before doctor speaks, while we are sitting down, my wife's eyes were starring in the hCG results number and she spotted the hCG number is 452. She smiles happily while doctor tells her "You are pregnant and congratulations! Come back after 2 weeks to scan for baby heartbeats. And please go out to the counter and ring the bell!”
Just Sharing My Thoughts
By all means, I’m not bragging about my success. I would like to say if anyone is planning on IVF, teamwork is very important and husband play a very important role to increase the success rate. Sometimes, I do feel like a spectator than a participant myself because I never experience any of the medical exams but this is not true. Every injection I put on her belly, I feel the pain in my heart as bad as she has on the belly. Ok, nothing much to share in this IVF journey and next time I might be sharing another journey as a Father! Here is my little baby girl Facebook page奥莉 Olivia Baby - 梁童心心 https://fb.me/oliviababylove if you wish to see her growth updates.
End.
#ivf #ivfmalaysia #ivfjourney #baby #alphafertility
fetch up中文 在 寵物雜貨舖寵物精品 Facebook 的最佳解答
中文翻譯轉貼自 Huang Vicki
圖片說明中譯:
這是兩週大幼犬的X光片
看看關節在發育完全之前,骨頭間的距離有多遠。
這是為何你永遠不應讓幼犬跳躍、上下樓梯、過度運動或過度訓練的原因。
幼年進行這麼劇烈的活動將導致成年之後的嚴重問題,甚或年紀還輕時即出現,因為幼犬的髖關節發育不全及其他骨骼疾病正不斷增加中!
謹記:幼犬規則是每長大一個月增加五分鐘的活動量!以兩個月幼犬為例,牠每天只需要十分鐘肢體活動,六個月幼犬每天只需要三十分鐘的肢體活動!!
*肢體活動包括:散步、訓練、玩拾回、奔跑、和狗玩等。
請享受養隻新幼犬的樂趣,但要記得你不會迫使六個月大的人類嬰兒每天跑一英哩,所以別強迫你的幼犬這麼做!
This is an X-ray of a 2 week old puppy.
Look at how far the bones have to grow before they become a proper bony joint! This is why you should never let puppies jump, walk up/down stairs, over exercise or over train. Doing to much impact activity at a young age will cause serious issues later in life, or even at a young age as hip dysplasia and other orthopaedic conditions are rising in puppies!
Remember the puppy rule for every month increase activity by 5 minuets! For example an 8 week old puppy only needs 10 minuets physical activity a day - a 6 month old only needs 30 minuets a day of physical activity!!
*physical activity includes - going for a walk, training, playing fetch, running, playing with other dogs etc.
Enjoy your new puppy but remember you wouldn't make a 6 month old baby run a mile a day so don't make your puppy either!
fetch up中文 在 YouTube Data API Overview | Google Developers 的推薦與評價
Introduction
This document is intended for developers who want to write applications that interact with YouTube. It explains basic concepts of YouTube and of the API itself. It also provides an overview of the different functions that the API supports.
Before you startYou need a Google Account to access the Google API Console, request an API key, and register your application.
Create a project in the Google Developers Console and obtain authorization credentials so your application can submit API requests.
After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use:
Go to the API Console and select the project that you just registered.
Visit the Enabled APIs page.
In the list of APIs, make sure the status is ON for the YouTube Data API v3.
If your application will use any API methods that require user authorization, read the authentication guide to learn how to implement OAuth 2.0 authorization.
Select a client library to simplify your API implementation.
Familiarize yourself with the core concepts of the JSON (JavaScript Object Notation) data format. JSON is a common, language-independent data format that provides a simple text representation of arbitrary data structures. For more information, see json.org.
Resources and resource types
A resource is an individual data entity with a unique identifier. The table below describes the different types of resources that you can interact with using the API.
Resources
activity
Contains information about an action that a particular user has taken on the YouTube site. User actions that are reported in activity feeds include rating a video, sharing a video, marking a video as a favorite, and posting a channel bulletin, among others.
channel
Contains information about a single YouTube channel.
channelBanner
Identifies the URL to use to set a newly uploaded image as the banner image for a channel.
channelSection
Contains information about a set of videos that a channel has chosen to feature. For example, a section could feature a channel's latest uploads, most popular uploads, or videos from one or more playlists.
guideCategory
Identifies a category that YouTube associates with channels based on their content or other indicators, such as popularity. Guide categories seek to organize channels in a way that makes it easier for YouTube users to find the content they're looking for. While channels could be associated with one or more guide categories, they are not guaranteed to be in any guide categories.
i18nLanguage
Identifies an application language that the YouTube website supports. The application language can also be referred to as a UI language.
i18nRegion
Identifies a geographic area that a YouTube user can select as the preferred content region. The content region can also be referred to as a content locale.
playlist
Represents a single YouTube playlist. A playlist is a collection of videos that can be viewed sequentially and shared with other users.
playlistItem
Identifies a resource, such as a video, that is part of a playlist. The playlistItem resource also contains details that explain how the included resource is used in the playlist.
search result
Contains information about a YouTube video, channel, or playlist that matches the search parameters specified in an API request. While a search result points to a uniquely identifiable resource, like a video, it does not have its own persistent data.
subscription
Contains information about a YouTube user subscription. A subscription notifies a user when new videos are added to a channel or when another user takes one of several actions on YouTube, such as uploading a video, rating a video, or commenting on a video.
thumbnail
Identifies thumbnail images associated with a resource.
video
Represents a single YouTube video.
videoCategory
Identifies a category that has been or could be associated with uploaded videos.
watermark
Identifies an image that displays during playbacks of a specified channel's videos. The channel owner can also specify a target channel to which the image links as well as timing details that determine when the watermark appears during video playbacks and then length of time it is visible.
Note that, in many cases, a resource contains references to other resources. For example, a playlistItem
resource's snippet.resourceId.videoId
property identifies a video resource that, in turn, contains complete information about the video. As another example, a search result contains either a videoId
, playlistId
, or channelId
property that identifies a particular video, playlist, or channel resource.
The following table shows the most common methods that the API supports. Some resources also support other methods that perform functions more specific to those resources. For example, the videos.rate
method associates a user rating with a video, and the thumbnails.set
method uploads a video thumbnail image to YouTube and associates it with a video.
Operations
list
Retrieves (
GET
) a list of zero or more resources.insert
Creates (
POST
) a new resource.update
Modifies (
PUT
) an existing resource to reflect data in your request.delete
Removes (
DELETE
) a specific resource.The API currently supports methods to list each of the supported resource types, and it supports write operations for many resources as well.
The table below identifies the operations that are supported for different types of resources. Operations that insert, update, or delete resources always require user authorization. In some cases, list
methods support both authorized and unauthorized requests, where unauthorized requests only retrieve public data while authorized requests can also retrieve information about or private to the currently authenticated user.
Supported Operations
list
insert
update
delete
activity
caption
channel
channelBanner
channelSection
comment
commentThread
guideCategory
i18nLanguage
i18nRegion
playlist
playlistItem
search result
subscription
thumbnail
video
videoCategory
watermark
Quota usage
The YouTube Data API uses a quota to ensure that developers use the service as intended and do not create applications that unfairly reduce service quality or limit access for others. All API requests, including invalid requests, incur at least a one-point quota cost. You can find the quota available to your application in the API Console.
Projects that enable the YouTube Data API have a default quota allocation of 10,000 units per day, an amount sufficient for the overwhelming majority of our API users. Default quota, which is subject to change, helps us optimize quota allocations and scale our infrastructure in a way that is more meaningful to our API users. You can see your quota usage on the Quotas page in the API Console.
Note: If you reach the quota limit, you can request additional quota by
completing the Quota extension
request form for YouTube API Services.
Google calculates your quota usage by assigning a cost to each request. Different types of
operations have different quota costs. For example:
A read operation that retrieves a list of resources -- channels, videos, playlists -- usually
costs 1 unit.
A write operation that creates, updates, or deletes a resource usually has costs
50
units.A search request costs
100
units.A video upload costs
1600
units.The Quota costs for API requests table shows the
quota cost of each API method. With these rules in mind, you can estimate the number of requests
that your application could send per day without exceeding your quota.
The API allows, and actually requires, the retrieval of partial resources so that applications avoid transferring, parsing, and storing unneeded data. This approach also ensures that the API uses network, CPU, and memory resources more efficiently.
The API supports two request parameters, which are explained in the following sections, that enable you to identify the resource properties that should be included in API responses.
The part
parameter identifies groups of properties that should be returned for a resource.
The fields
parameter filters the API response to only return specific properties within the requested resource parts.
part
parameterThe part
parameter is a required parameter for any API request that retrieves or returns a resource. The parameter identifies one or more top-level (non-nested) resource properties that should be included in an API response. For example, a video
resource has the following parts:
snippet
contentDetails
fileDetails
player
processingDetails
recordingDetails
statistics
status
suggestions
topicDetails
All of these parts are objects that contain nested properties, and you can think of these objects as groups of metadata fields that the API server might (or might not) retrieve. As such, the part
parameter requires you to select the resource components that your application actually uses. This requirement serves two key purposes:
It reduces latency by preventing the API server from spending time retrieving metadata fields that your application doesn't use.
It reduces bandwidth usage by reducing (or eliminating) the amount of unnecessary data that your application might retrieve.
Over time, as resources add more parts, these benefits will only increase since your application will not be requesting newly introduced properties that it doesn't support.
How to use thefields
parameterThe fields
parameter filters the API response, which only contains the resource parts identified in the part
parameter value, so that the response only includes a specific set of fields. The fields
parameter lets you remove nested properties from an API response and thereby further reduce your bandwidth usage. (The part
parameter cannot be used to filter nested properties from a response.)
The following rules explain the supported syntax for the fields
parameter value, which is loosely based on XPath syntax:
Use a comma-separated list (fields=a,b
) to select multiple fields.
Use an asterisk (fields=*
) as a wildcard to identify all fields.
Use parentheses (fields=a(b,c)
) to specify a group of nested properties that will be included in the API response.
Use a forward slash (fields=a/b
) to identify a nested property.
In practice, these rules often allow several different fields
parameter values to retrieve the same API response. For example, if you want to retrieve the playlist item ID, title, and position for every item in a playlist, you could use any of the following values:
fields=items/id,playlistItems/snippet/title,playlistItems/snippet/position
fields=items(id,snippet/title,snippet/position)
fields=items(id,snippet(title,position))
Note: As with all query parameter values, the fields
parameter value must be URL encoded. For better readability, the examples in this document omit the encoding.
The examples below demonstrate how you can use the part
and fields
parameters to ensure that API responses only include the data that your application uses:
Example 1 returns a video resource that includes four parts as well as
kind
and etag
properties.Example 2 returns a video resource that includes two parts as well as
kind
and etag
properties.Example 3 returns a video resource that includes two parts but excludes
kind
and etag
properties.Example 4 returns a video resource that includes two parts but excludes
kind
and etag
as well as some nested properties in the resource's snippet
object.Example 1
URL: https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=YOUR_API_KEY
&part=snippet,contentDetails,statistics,statusDescription: This example retrieves avideo
resource and identifies several
resource parts that should be included in the API response.API response:
{
"kind": "youtube#videoListResponse",
"etag": "\"UCBpFjp2h75_b92t44sqraUcyu0/sDAlsG9NGKfr6v5AlPZKSEZdtqA\"",
"videos": [
{
"id": "7lCDEYXw3mM",
"kind": "youtube#video",
"etag": "\"UCBpFjp2h75_b92t44sqraUcyu0/iYynQR8AtacsFUwWmrVaw4Smb_Q\"",
"snippet": {
"publishedAt": "2012-06-20T22:45:24.000Z",
"channelId": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
"title": "Google I/O 101: Q&A On Using Google APIs",
"description": "Antonio Fuentes speaks to us and takes questions on working with Google APIs and OAuth 2.0.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/hqdefault.jpg"
}
},
"categoryId": "28"
},
"contentDetails": {
"duration": "PT15M51S",
"aspectRatio": "RATIO_16_9"
},
"statistics": {
"viewCount": "3057",
"likeCount": "25",
"dislikeCount": "0",
"favoriteCount": "17",
"commentCount": "12"
},
"status": {
"uploadStatus": "STATUS_PROCESSED",
"privacyStatus": "PRIVACY_PUBLIC"
}
}
]
}
Example 2
URL: https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=YOUR_API_KEY
&part=snippet,statisticsDescription: This example modifies thepart
parameter value so that the
contentDetails
andstatus
properties are not included
in the response.API response:
{
"kind": "youtube#videoListResponse",
"etag": "\"UCBpFjp2h75_b92t44sqraUcyu0/sDAlsG9NGKfr6v5AlPZKSEZdtqA\"",
"videos": [
{
"id": "7lCDEYXw3mM",
"kind": "youtube#video",
"etag": "\"UCBpFjp2h75_b92t44sqraUcyu0/iYynQR8AtacsFUwWmrVaw4Smb_Q\"",
"snippet": {
"publishedAt": "2012-06-20T22:45:24.000Z",
"channelId": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
"title": "Google I/O 101: Q&A On Using Google APIs",
"description": "Antonio Fuentes speaks to us and takes questions on working with Google APIs and OAuth 2.0.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/hqdefault.jpg"
}
},
"categoryId": "28"
},
"statistics": {
"viewCount": "3057",
"likeCount": "25",
"dislikeCount": "0",
"favoriteCount": "17",
"commentCount": "12"
}
}
]
}
Example 3
URL: https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=YOUR_API_KEY
&part=snippet,statistics&fields=items(id,snippet,statistics)Description: This example adds thefields
parameter to remove all
kind
andetag
properties from the API response.API response:
{
"videos": [
{
"id": "7lCDEYXw3mM",
"snippet": {
"publishedAt": "2012-06-20T22:45:24.000Z",
"channelId": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
"title": "Google I/O 101: Q&A On Using Google APIs",
"description": "Antonio Fuentes speaks to us and takes questions on working with Google APIs and OAuth 2.0.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/7lCDEYXw3mM/hqdefault.jpg"
}
},
"categoryId": "28"
},
"statistics": {
"viewCount": "3057",
"likeCount": "25",
"dislikeCount": "0",
"favoriteCount": "17",
"commentCount": "12"
}
}
]
}
Example 4
URL: https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=YOUR_API_KEY
&fields=items(id,snippet(channelId,title,categoryId),statistics)&part=snippet,statisticsDescription: This example modifies thefields
parameter from example 3
so that in the API response, each video resource'ssnippet
object only includes thechannelId
,title
,
andcategoryId
properties.API response:
{
"videos": [
{
"id": "7lCDEYXw3mM",
"snippet": {
"channelId": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
"title": "Google I/O 101: Q&A On Using Google APIs",
"categoryId": "28"
},
"statistics": {
"viewCount": "3057",
"likeCount": "25",
"dislikeCount": "0",
"favoriteCount": "17",
"commentCount": "12"
}
}
]
}
Optimizing performance
Using ETags
ETags, a standard part of the HTTP protocol, allow applications to refer to a specific version of a particular API resource. The resource could be an entire feed or an item in that feed. This functionality supports the following use cases:
Caching and conditional retrieval – Your application can cache API resources and their ETags. Then, when your application requests a stored resource again, it specifies the ETag associated with that resource. If the resource has changed, the API returns the modified resource and the ETag associated with that version of the resource. If the resource has not changed, the API returns an HTTP 304 response (Not Modified
), which indicates that the resource has not changed. Your application can reduce latency and bandwidth usage by serving cached resources in this manner.
The client libraries for Google APIs differ in their support of ETags. For example, the JavaScript client library supports ETags via a whitelist for allowed request headers that includes If-Match
and If-None-Match
. The whitelist allows normal browser caching to occur so that if a resource's ETag has not changed, the resource can be served from the browser cache. The Obj-C client, on the other hand, does not support ETags.
Protecting against inadvertent overwrites of changes – ETags help to ensure that multiple API clients don't inadvertently overwrite each other's changes. When updating or deleting a resource, your application can specify the resource's ETag. If the ETag doesn't match the most recent version of that resource, then the API request fails.
Using ETags in your application provides several benefits:
The API responds more quickly to requests for cached but unchanged resources, yielding lower latency and lower bandwidth usage.Your application will not inadvertently overwrite changes to a resource that were made from another API client.
The Google APIs Client Library for JavaScript supports If-Match
and If-None-Match
HTTP request headers, thereby enabling ETags to work within the context of normal browser caching.
Using gzip
You can also reduce the bandwidth needed for each API response by enabling gzip compression. While your application will need additional CPU time to uncompress API responses, the benefit of consuming fewer network resources usually outweighs that cost.
To receive a gzip-encoded response you must do two things:
Set the Accept-Encoding
HTTP request header to gzip
.
Modify your user agent to contain the string gzip
.
The sample HTTP headers below demonstrate these requirements for enabling gzip compression:
Accept-Encoding: gzip
User-Agent: my program (gzip)
... <看更多>
fetch up中文 在 如何使用Fetch API 進行前後端串接? #17 - GitHub 的推薦與評價
如何使用Fetch API 進行前後端串接? #17 ... 亂碼 //echo json_encode($row); [3] 中文資料經過json 編碼之後呈現亂碼 $data = array(); if ... ... <看更多>