Youtube bans my country's IP addresses and we can't access Youtube. I try to change Skytube which is open-source to access Youtube without an external VPN or proxy App. I'm going to rent a server in another country to create an OpenVPN or PPTP VPN. can I create an intenal-app VPN that only tunnels my youtube traffic into VPN? how? or I must Add a Proxy java class over NetHttpTransport? and how I do it?
This is the method that initializes Youtube Connection in Skytube: 👇👇👇👇👇👇👇
public static YouTube create() {
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = AndroidJsonFactory.getDefaultInstance();
return new YouTube.Builder(httpTransport, jsonFactory, new HttpRequestInitializer() {
private String getSha1() {
String sha1 = null;
try {
Signature[] signatures = SkyTubeApp.getContext().getPackageManager().getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_SIGNATURES).signatures;
for (Signature signature: signatures) {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(signature.toByteArray());
sha1 = BaseEncoding.base16().encode(md.digest());
}
} catch (Throwable tr) {
Logger.e(this, "...", tr);
}
return sha1;
}
@Override
public void initialize(HttpRequest request) throws IOException {
request.getHeaders().set("X-Android-Package", BuildConfig.APPLICATION_ID);
request.getHeaders().set("X-Android-Cert", getSha1());
}
}).setApplicationName("+").build();
}