MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / changeCountry

Function changeCountry

scripts/youtube_changeCountry.js:91–115  ·  view source on GitHub ↗
(value, persist)

Source from the content-addressed store, hash-verified

89};
90
91function changeCountry(value, persist) {
92 if (value) {
93 let href = "https://www.youtube.com/feed/trending";
94 if (persist) {
95 if (value !== "default") {
96 var date = new Date();
97 date.setTime(date.getTime() + 3.154e10);
98
99 document.cookie =
100 "s_gl=" +
101 value +
102 "; path=/; domain=.youtube.com; expires=" +
103 date.toGMTString();
104 } else {
105 document.cookie =
106 "s_gl=0; path=/; domain=.youtube.com; expires=Thu, 01 Jan 1970 00:00:01 GMT";
107 }
108
109 window.location.href = href;
110 } else {
111 href += `?persist_gl=0&gl=${value}`;
112 window.location.href = href;
113 }
114 }
115}
116
117function getCurrentCountry() {
118 const code =

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected