Igor's Blog

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.

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

comments powered by Disqus
Other posts you may like...
Programming, DIY, Games, Hacks, and Tech

Recent Blog Posts

A guide for plotting your hard drive for Burstcoin mining on a Mac using mjminer

Replacing a broken hard drive in a Samsung Story Station

Fix Java applications slow start and net connection times on macOS sierra

Pierre Cardin Leather Computer Bag (PC2278)

How to stop SSH remote host disconnecting your session

Using PayPal PHP SDK on Google App Engine

Use the Touch Bar to lock your Mac with a single button press

Multi module builds with Maven 3.5 and the parent-child pom version management

Google App Engine local dev server DataStore becoming corrupted after a bad GQL statement is run

Unboxing my new 2017 2.9Ghz 15" MacBook Pro

Recent Galleries

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

DIY indoor apartment grow light wiring

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 feel obliged, but you could follow me for more great content!
     
Don't show this again