Support for Android Firefox and m.youtube.com

should fix #68 and #143

List of changes:
* Suppress mobile user agents in background script
* Also look for the mobile equivalents of relevant HTML Elements
* More consistently use get[Dis]LikeButton() instead of getButtons().children
* Add mobile-specific css tweaks
This commit is contained in:
AgentConDier committed 2021-12-08 20:47:56 +01:00
1 parent 85dd78f415
commit 8f934251a1
3 files changed
+59 -25

No files matched your search

@@ -46,8 +46,14 @@ browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
toSend = [];
}
} else if (request.message == "fetch_from_youtube") {
let headers = {}
if (navigator && navigator.userAgent) {
// Never request mobile version
headers["User-Agent"] = navigator.userAgent.replace(/\(.*Mobile;/,"(X11; Linux x86_64;");
}
fetch(`https://www.youtube.com/watch?v=${request.videoId}`, {
method: "GET",
headers: headers
})
.then((response) => response.text())
.then((text) => {