Help With Blocking YouTube Ads

Discussion in 'Android Hacks and Help' started by HarvesterX™, Aug 24, 2014.

  1. HarvesterX™

    HarvesterX™ Member

    Joined:
    May 13, 2010
    Messages:
    557
    Likes Received:
    9
    Trophy Points:
    18
    Location:
    Virginia, USA
    Ratings:
    +9
    Well the title says it. I'm running a VS980 G2 on CloudyG3 1.3 (ported G3 ROM), and running in ART so let's not talk about Xposed Framework...thats why I have Apktool Mobile.

    I've tired the hosts file approach and added some YouTube ad hosts I found on XDA (along with the default Adaway list AND the MoAB list which covers most everything, well most everything except YouTube, and the YouTube ad hosts I tried just have worked in older on older YouTube builds but no more.

    If anyone has any working hosts sources I could add, then perfect. Otherwise I think I'm going to have to dig out Apktool. Before I even start digging around small code I'll ask if anyone else has already found the offending code and made a patch for it.

    Between modifying the hosts file and decompiling the app I guess I have a decent shot at figuring this out, unless maybe there's another alternative I've missed.

    Edit:

    Just digging around data some and the first thing I've found was a "last_ad_time" in data/data/youtube (yeah shortened it) and /data/user/0/youtube (again), I wonder if I simply modify this value to, say 5 years in the future if it will stop serving serving ads. Can't be that easy..

    The date is in this format:1408916918034. Now I can tell you I saw an ad earlier today and today is the 24, and there is no 24 in that string so I either need to decode how to reas this, or just see what replacing each nunber with a 9 will do.

    Probably nothing, cause there's also a "download only while charging" preference set to true and I can download when I'm not charging so dunno.. The format doesn't appear to have been made with the DateFormat class, but let's see. The first two numbers appear to be the year. Then the next two look like the month. Now 9161 doesn't ring any bells so lemme go fire up YouTube until I get another ad and then look through some catlogs as well as notice what time the ad occurs at. I'm thinking this is probably more for analytical data then governing ads though, so the catlog will probably be much more useful.
     
    #1 HarvesterX™, Aug 24, 2014
    Last edited: Aug 24, 2014
  2. HarvesterX™

    HarvesterX™ Member

    Joined:
    May 13, 2010
    Messages:
    557
    Likes Received:
    9
    Trophy Points:
    18
    Location:
    Virginia, USA
    Ratings:
    +9
    OK, so I finally managed to get one ad to appear (must be blocking a lot of them with my hosts file) and got the log and noticed the class handling that serves up the ads, but lost it while trying to get a partial log out of it.

    Haven't ran into another ad in ages. Wanted to grab the URL from the log and add to hosts BUT, I decided to see what happens by juat deleting the class from the app. It's done recompiling so let's hope it's the ad server, and that it doesn't force close and instead just throws a warning . I doubt it..but might as well try that first before digging through all the other classes inside it.

    Found the ad url I thought I lost. It's one i manually have blacklisted in adaway so that's no good. At least I have the class, so let's see if we can bypass around any as calls.
     
    #2 HarvesterX™, Aug 24, 2014
    Last edited: Aug 24, 2014
  3. HarvesterX™

    HarvesterX™ Member

    Joined:
    May 13, 2010
    Messages:
    557
    Likes Received:
    9
    Trophy Points:
    18
    Location:
    Virginia, USA
    Ratings:
    +9
    Finally found the class handling the ads. Also found what I'm pretty sure are the string urls corresponding to each server. First though, I'm attempting a build where I removed all the calls (left the methods, but just returned void and cleared the rest of the methods out) and see if that works. If not, I'll just change the string constants to point to 120.0.0.1 for each one and just redirect the ads back to localhost just as if they were added to hosts file.
     
  4. shadowx360

    shadowx360 New Member

    Joined:
    Nov 13, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    So did you ever get that list of string constants to add to the hosts file? I don't like using the MoaAB list because it blocks a lot of Google Play store images and such but the original AdAway lists aren't enough to block the youtube ads.
     
Search tags for this page
adaway host link for block youtube ads
,
adaway hosts xda
,
adaway moab
,
adaway xda lists
,

adaway youtube host

,
adaway youtube hosts sources
,

moab adaway

,

moab xda

,
remove ads youtube xda
,
xda youtube without ad