阻止YouTube视频在Firefox中自动播放

It drives me crazy that YouTube videos start playing automatically. It’s especially annoying when you click on a link from a co-worker and then the phone rings… and then your speakers start blaring a completely inappropriate sound, usually accompanied by terrible dancing.

YouTube视频开始自动播放让我发疯。 当您单击同事的链接,然后电话响起时,尤其令人烦恼……然后您的扬声器开始发出完全不适当的声音,通常伴随着可怕的舞蹈。

So I went searching for the best method to disable these videos from playing automatically, and came up with three different options that I’ve listed for you here.

因此,我一直在寻找使这些视频无法自动播放的最佳方法,并提出了我在这里为您列出的三个不同选项。

Method 1: Using the StopAutoPlayingAlready Extension

方法1:使用StopAutoPlayingAlready扩展

I’ve created an extension for Firefox that will prevent YouTube videos from automatically playing by converting the default player to the embedded one that doesn’t auto-play.

我已经为Firefox创建了一个扩展程序,该扩展程序可以通过将默认播放器转换为无法自动播放的嵌入式播放器来防止YouTube视频自动播放。

Note: I can’t really take any credit for this, because all of the logic is from the greasemonkey script below. All I did was convert it into an extension for people that don’t use greasemonkey.

注意:我对此实在不敢恭维,因为所有逻辑均来自下面的oilsmonkey脚本。 我所做的就是将其转换为不使用油烟猴的人的扩展。

Once you install the extension, you’ll notice that the videos on YouTube.com now have the play button:

安装扩展程序后,您会注意到YouTube.com上的视频现在具有播放按钮:

image

To install, download the extension to your hard drive, and then drag it to your Firefox Add-ons dialog:

要安装,请将扩展下载到您的硬盘驱动器,然后将其拖到“ Firefox加载项”对话框中:

ffadons.png

Install StopAutoPlayingAlready Extension for Firefox

为Firefox安装StopAutoPlayingAlready Extension

Method 2: Using the Youtube Prevent Autoplay Script

方法2:使用Youtube Prevent自动播放脚本

If you love using Greasemonkey you’ll probably prefer this method. All you need to do is install the greasemonkey script and it will work exactly as the extension above.

如果您喜欢使用Greasemonkey,则可能会喜欢这种方法。 您需要做的就是安装油腻的monkey脚本,它将完全按照上面的扩展名运行。

All of the credit goes to Yansky for figuring out this method. I assume he used Fry’s 7-leaf clover.

所有的功劳归于Yansky找出了这种方法。 我认为他用的是弗莱的七叶草。

Download Youtube Prevent Autoplay Script from userscripts.org

从userscripts.org下载YouTube阻止自动播放脚本

Method 3: Using the Stop Autoplay Extension

方法3:使用停止自动播放扩展

This extension will not only stop Youtube videos from auto-playing, but will stop all embedded media from playing automatically. Note that if you use this extension you really don’t need the other solutions.

该扩展程序不仅会阻止Youtube视频自动播放,而且会阻止所有嵌入式媒体自动播放。 请注意,如果您使用此扩展程序,则实际上不需要其他解决方案。

After installing this extension, you’ll notice that the video is completely gone from the page.

安装此扩展程序后,您会注意到该视频已从页面中完全消失。

image

Once you click on the video, it will then load and then start playing. This definitely isn’t quite as elegant of a solution, but if it’s brute force you want, enjoy!

单击视频后,它将加载并开始播放。 这绝对不是解决方案的优雅之处,但是如果您要蛮力的话,那就享受吧!

Install Stop Autoplay Extension from Mozilla Add-ons

从Mozilla附加组件安装Stop Autoplay Extension

Method 4: FlashBlock Extension

方法4:FlashBlock扩展

I’m adding this to the list per suggestion from the readers… you can also use the FlashBlock extension to completely block flash, which is a good option for some people. It will block the flash players exactly the same as the other solutions… just click on it to make it play.

我根据读者的建议将其添加到列表中……您也可以使用FlashBlock扩展完全阻止闪存,这对于某些人来说是个不错的选择。 它将阻止Flash播放器与其他解决方案完全相同……只需单击它即可播放。

flashblock2.png

Download FlashBlock Extension from mozdev.org

从mozdev.org下载FlashBlock扩展

翻译自: https://www.howtogeek.com/howto/internet/firefox/stop-youtube-videos-from-automatically-playing-in-firefox/

YouTube视频爬虫通常指的是使用Python编写的一段代码,用于从YouTube平台提取视频的播放量等信息。要实现这样的爬虫,你需要遵循以下步骤: 1. **了解YouTube Data API**:YouTube提供了一个官方的API,允许开发者以程序化的方式获取YouTube视频、频道和评论等数据。通过这个API,可以合法地获取视频的播放量等信息,而不需要直接爬取网页内容,这通常更稳定且符合YouTube的使用条款。 2. **获取API密钥**:为了使用YouTube Data API,你需要在Google开发者控制台注册一个项目并获取一个API密钥。这个密钥将用于API请求,以验证你的身份。 3. **编写爬虫代码**:使用Python,你可以利用`google-api-python-client`库来与YouTube Data API进行交互。首先安装该库,然后编写代码来查询特定视频的数据,例如: ```python from googleapiclient.discovery import build # API密钥 API_KEY = '你的API密钥' # 构建YouTube API客户端 youtube = build('youtube', 'v3', developerKey=API_KEY) # 视频ID video_id = '视频的ID' # 获取视频信息 request = youtube.videos().list( part='statistics', id=video_id ) response = request.execute() # 打印播放量 print(response['items'][0]['statistics']['viewCount']) ``` 4. **处理API请求限制**:YouTube API有使用限制,例如每分钟的请求数量限制。因此,确保你的爬虫能够妥善处理这些限制,例如通过增加请求间隔时间来避免超出限制。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值