Igor's Blog
Programming, DIY, Games, Hacks, and Tech

I've purchased many an item from Banggood simply because they offer interesting things at low prices. I also am signed up as an affiliate so that I can have an additional funding source for this Blog. One of the annoying things that I've found with their affiliate program is the need to copy each of their advertising banners manually by hand every month. That in fact prevented me from putting their advertising on my Blog, until now.
Update 01-August-2017: This no longer works! Banggood changed their web site and made is forcing everyone to collect banner ad code manually.


This weekend I decided to play around with the Referral Code & Report part of their site to see if I could do something to help getting the banner code a bit easier. With a little bit of JavaScript I was able to automatically extract all of the banner code in one go without having to click through all the screens. Here's how.

Bit of a disclaimer before you continue: use this at your own risk of course. Banggood can change the behaviour of their site at any time, but this works for now at least. The code is completely safe to use, it isn't a hack, it's just using the functions provided by the website already.

You will need an account with Banggood. You will also need to be signed up as an affiliate. Go to the Referral Code & Report and bring up the JavaScript/Development Console in your browser. The referral page looks something like this:
banggood_code1.png


Enter the following into the JavaScript Console and wait for the updated page to finish loading.
 JavaScript
changeShowNum(200);


That changes how many banner ads the site shows to you in one go. The number 200 seemed like a good amount for me, it doesn't actually go up that high, but better to try and show more than having to go through multiple pages.

Next enter the following code:
 JavaScript
selbannerimagesize(13);getBannerlist();




That tells the site to load 728x90 banners. You can tell it to load others e.g. 336x280 if you change that 13 to a 4. Different numbers here correspond to different banner sizes, I didn't try to document them all.

Now that all the banners of the same size have been loaded it's time to extract their codes. Enter the following into the JavaScript Console and run it:
 JavaScript
var s = '\n'; $('.banner_code_list').find('li').each(function(idx, el) { var e = $(el); s += '<a rel="nofollow" href="' + e.find('a').attr('href') + '" target="_blank"><img src="' + e.find('img').attr('src') + '"/></a>\n'; }); console.log(s);


That puts all of the banner code into the console, which you can then select and copy. The approach used here is the same as Banggood does itself so should work identically.
banggood_code2.png


-i

Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...

Recent Blog Posts

How to enable the full stack trace in Maven's Surefire plugin for JUnit testing

Twelve elements of the Burst Mining Pool interface explained

TPG FTTB settings for the Billion BiPAC 8700AXL 1600 modem router

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

How to fix SoapUI javax.net.ssl.SSLHandshakeException calling WebLogic 12.2 web services on Java 8

Woolworths (WOW) shares disappeared from Computer Share Investor Centre

Connecting the Dell UltraSharp U3415W monitor to a MacBookPro via USB-C

How to add/change PHP versions appearing in MAMP preferences

Fix the ORA-00904: ORA_ROWSCN: invalid identifier error in SQLDeveloper with a few easy steps

G Suite Gmail is broken on Safari due to new Google Content Security Policy settings

Recent Galleries

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
300 George St Blogumentary

My Online Tools

UUID to OID Converter
Guru JSON-RPC Tester
Extrudifier Object Designer
Travel ┬ÁBlog

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Don't forget to
my Facebook page for more great articles!
Don't show this again