Friday, February 12, 2016

Ecap Squid - Plugin Youtube quality locker

Source : http://blog.dokter-squid.com/ecap-squid-plugin-youtube-quality-locker/

Requierements:
  1. Squid Cache V 3.5.X min
  2. Linux Debian atau Ubuntu
  3. Libecap V.1, Silahkan Download Disini
  4. Ecap adapter, Silahkan Download Disini
Install :

1. Install pkg-config : apt-get install pkg-config

2. Install Libecap yang sudah anda download
   
tar -xzf libecap-1.0.0.tar.gz
cd libecap-1.0.0/
./configure
sudo make && make install

3. Install adapter nya,

tar zxvf ecap_adapter_DSI.tar.gz
cd ecap_adapter_sample-1.0.0

- Patch adapternya dulu sebelum diconfigure :
 Edit file /src/adapter_async.cc :
 Tambahkan text berwarna merah dibawah  #include <list>
--------------------------------------------------------------
#include "sample.h"
 #include "Debug.h"
 #include <libecap/common/registry.h>
 #include <libecap/common/errors.h>
 #include <libecap/adapter/service.h>
 #include <libecap/adapter/xaction.h>
 #include <libecap/host/host.h>
 #include <libecap/host/xaction.h>
 #include <assert.h>
 #include <iostream>
 #include <list>
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #if HAVE_PTHREAD
 #include <pthread.h>
 #endif
--------------------------------------------------------------

./configure
sudo make && make install
cd
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

4. ./configure Squid dengan mengaktifkan  –enable-ecap

5.Edit squid.conf anda lalu masukan script di bawah ini:
   
acl youtube_240 dstdomain .youtube.com
request_header_access Accept-Encoding deny youtube_240
loadable_modules /usr/local/lib/ecap_adapter_modifying.so
ecap_enable on
ecap_service ecapModifier respmod_precache uri=ecap://dokter-squid.com/ecap yt_quality=small
adaptation_access ecapModifier allow youtube_240
adaptation_access ecapModifier deny all

6.Restart squid anda, lalu liat resolusi pada video youtube, jika sudah tidak auto berarti anda sudah berhasil.

Note:
A. Untuk Penggunaan Resolusi tertentu silahkan rubah pada scrip di bagian “yt_quality=(disini)”

tiny = 144px
small = 240px
medium = 360px
large = 480px
HD720 = Hd720px

Contoh : jika anda ingin menggunakan resolusi 240 maka, rubah bagian scrip pada squid.conf seperti ini : yt_quality=small.

B. Untuk mengubah uri=ecap://dokter-squid.com/ecap
Sebelum dicompile edit dulu file /src/adapter_modifying.cc :
std::string Adapter::Service::uri() const {
    return "ecap://dokter-squid.com/ecap";

Ganti yang diblock merah jadi terserah anda.










No comments:

Post a Comment