5 ms·
My last contract job was to build a 100% perfect website mirroring program for a group of lawyers who were interested in building class action lawsuits against
by cubano 6y ago
My last contract job was to build a 100% perfect website mirroring program for a group of lawyers who were interested in building class action lawsuits against some of the more henious scammers out there.
I ended up building like 8 versions of it, literally using every PHP and Python library and resource I could find.
I tried httrack, php-ultimate-web-scraper (from github), headless chromium. headless selenium, and a few others
By far the biggest problem was dealing with JS links...you wouldn't think from the start it would be such a big deal but yet..it was.
Selenium with python turned out to be the winning combination, and of course, it was the last one I tried. Also, this is an ideal project to implement recursion altho you have to be careful about exit conditions.
One thing that was VERY important for performance was not visiting any page more then once because, obviously, certain links in headers and footers are duped sometimes 100s of times.
JS links often made it very difficult to discover the linked page, are certain library calls that were supposed to get this info for you often didn't work.
It was a super fun project, and in the end considering I only worked for 2 months, I shipped some decent code that was getting like 98.6% of the pages perfectly.
The final presentation was interesting...for some reason my client I think got in his head that I wasn't very good programmer or something, and as we ran thru his list of sample sites expecting my program to error out or incorrectly mirror the site, but it handled all 10 of the sites about perfectly and he was rather flabbergasted because he told me it would have taken him a week hand clicking the site for the mirror but instead the program did them all in under an hour.
- lysecret 6y agoWhat stack did you end up using ?
- sdfsrrte543 6y ago>Selenium with python turned out to be the winning combination, and of course, it was the last one I tried.
- lysecret 6y agoCool that's wht I'm using too!:)
- gazelle21 6y agoHa! I am currently building something very similar at work, and JS links are driving me up a wall. Its interesting because you would think its super simple, but I still haven't found a good solution. Luckily my boss is understanding.
- banana_giraffe 6y agoI had to solve nearly the exact same problem for the same reasons. I too ended up with Selenium. My favorite part was having a nice working system, then throwing it in the cloud and finding out a socking number of sites tell you to go away if you come at them from a cloud-based IP. Shouldn't be surprising, but it was still annoying.
- Terretta 6y agoThere are a number of so-called “residential VPN” services with clients that also serve as the firm’s p2p VPN / proxy edge. Some can be subscribed to commercially to resolve precisely the above issue. Preferably, only give money to one that tells their users this is how it works.
- banana_giraffe 6y agoTrue. We went down that path for a while, but for our purposes, I was never happy with the ones I could find, since they were super vague how they got the IPs in the first place. Some of it felt like protecting commercial secrets, which is fine, but some of it felt like protecting questionable business practices. For our purposes, and the websites we needed to track, a traditional VPN was good enough.
- concreteblock 6y agoCan you explain why the lawyers needed mirror sites? Does mirroring a site mean making a local copy of it?