將 YouTube 視頻轉換為動畫 GIF 時可能會出現此錯誤,這意味著視頻無法轉換,因為它有年齡限製或已被刪除,或者正在從錯誤的國家/地區觀看。 雖然對於已刪除的視頻無能為力,但其他兩個錯誤有解決方案。
要觀看有年齡限制的視頻,您需要使用已確認年齡的 YouTube 帳戶。 為此,您應該登錄 YouTube 並在瀏覽器中打開開發人員工具(通常按 F12),然後找到網頁的 cookie。 然後識別 YouTube 的會話 cookie,目前稱為 SID
及 SSID
。 然後使用以下命令將這些 cookie 的名稱、域和值添加到 GrabzIt 自定義 cookie 頁面,最好使用未來很長一段時間內的到期日期來確保會話 cookie 不被刪除。 請注意,此操作的風險由您自行承擔,我們根據我們的規定不承擔任何責任 條款和條件.
您可以通過在請求轉換僅限於一個國家/地區的視頻時指定不同的國家/地區代碼來繞過此問題。
目前一個 國家可以設置為美國、英國或新加坡,下面是為每個 API 庫設置國家/地區的示例。
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); AnimationOptions options = new AnimationOptions(); options.Country = Country.US; grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options); grabzIt.Save("http://www.mywebsite.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); AnimationOptions options = new AnimationOptions(); options.setCountry(Country.UNITEDSTATES); grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options); grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.5.2/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("https://www.youtube.com/watch?v=a1Y73sPHKxw",
{"format":"gif", "country":"US"}).Create();
</script>
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret"); client.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw", {"country":"US"}); client.save("http://www.example.com/handler", function (error, id){ if (error != null){ throw error; } });
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = GrabzItAnimationOptions->new(); $options->country("US"); $grabzIt->URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", $options); $grabzIt->Save("http://www.mywebsite.com/handler.pl");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = new \GrabzIt\GrabzItAnimationOptions(); $options->setCountry("US"); $grabzIt->URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", $options); $grabzIt->Save("http://www.mywebsite.com/handler.php");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItAnimationOptions.GrabzItAnimationOptions() options.country = "US" grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options) grabzIt.Save("http://www.mywebsite.com/handler.py")
https://api.grabz.it/services/convert?key=c3VwcG9ydEBncmFiei5pdA==&format=gif&country=US&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Da1Y73sPHKxw
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzIt::AnimationOptions.new() options.country = "US" grabzIt.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options) grabzIt.save("http://www.mywebsite.com/handler/index")