Is C++ a good choice to make bots?

Saying python is minimal doesn't necessarily say c++ isn't. Makes sense?

I guess you have no idea about python. It's ok, but please man... Don't talk rubbish.

Also, stop putting words into my mouth that i did not say.

You said that indirectly.

I use Python for Statistics (or what they call as Machine Learning (The dumbest thing in the universe)).

Python rocks in that area.

And then there is me:
tumblr_ljh0puClWT1qfkt17.gif


who uses,
- Vue & PHP for control panel
- Python for machine learning and AI
- Node for asynchronous tasks and browser emulation
- C++ for some heavy-duty scraping & API penetrating


It's not about which tool is better.

But where to use it.


if there will be a java based tool that can help me, I will add java to this stack as well, w/o blink of an eye.

If you want to refactor your stack, You can cut down PHP and Node here.

I suggest following stack,

Svelte.js for control panel front end
C++ for control panel backend

See here for NodeJS Express style framework for Modern C++,

https://github.com/expresscpp/expresscpp
Code:
#include "expresscpp/expresscpp.hpp"

int main() {

  auto expresscpp = std::make_shared<expresscpp::ExpressCpp>();

  expresscpp->Get("/", [](auto /*req*/, auto res) { res->Send("hello world!"); });

  constexpr uint16_t port = 3000u;

  expresscpp->Listen(port,[=](auto /*ec*/) { std::cout << "Listening on port " << port << std::endl; }).Run();

  return 0;

}


C++ for async tasks and browser emulation as-well as heavy-duty scraping & API penetrating

C++ has Node style async concurrency with std::future

https://en.cppreference.com/w/cpp/thread/future\
C++ will saves you ton of server costs.

You also can use C++ for machine learning.

Tensorflow has C++ APIs .

C++ also has JIT compiler which you can use in Google Colab.
 
You said that indirectly.
Let's cut the fluff. No i didn't. If you still think I did, you got me wrong. C++ has been around for a long time, and there's enough tooling to make it efficient for those who use it.

Additionally, I am not sold to a language or tool. I'd use anything that makes my job quicker. Hope you understand.
 
If you want to refactor your stack, You can cut down PHP and Node here
Then I would need to build n+ different tools and libraries that simply do not exist as alternatives.

And they do not exist for a reason.

It's not about language.

But where to use it.

Wisely.
 
Then I would need to build n+ different tools and libraries that simply do not exist as alternatives.

And they do not exist for a reason.

It's not about language.

But where to use it.

Wisely.
I guess it comes down to making money with coding skills vs being in college. LOL. ;)
 
I would suggest C or python, but if you can Handke C++ go for it :cool:
 
if you are architecting a scalable solution to build a basic bot you are doing it wrong... This man needs something simple he isn't scaling to serve millions of concurrent users. C++ is overkill.

The real answer is to go with python or js using existing libs and learn C++ for future use.
 
if you are architecting a scalable solution to build a basic bot you are doing it wrong... This man needs something simple he isn't scaling to serve millions of concurrent users. C++ is overkill.

The real answer is to go with python or js using existing libs and learn C++ for future use.

Come on. He doesn't have users either. He is not building a basic bot either. He wants to target a lot of sites.

C++ is not overkill compared to Typescript. If you can write Typescript, you can write C++ too.

C++ is like Python these days. Really easy to use.

https://preshing.com/20141202/cpp-has-become-more-pythonic/
It never has been overkill. C++ is a good choice. You don't have to write in C++ later you can go C++ all in.
 
Then I would need to build n+ different tools and libraries that simply do not exist as alternatives.

And they do not exist for a reason.

It's not about language.

But where to use it.

Wisely.


What are that different tools and libraries you have create yourself?

Show me as single library Modern C++ doesn't has but exists in Node/Python.

I'm sure you are using C not Modern C++. The Collages teach poor old C with classes. Yanks!

You can even build your front end with C++,

https://mbasso.github.io/asm-dom/
Vue like framework for C++

I would suggest C or python, but if you can Handke C++ go for it :cool:

What???? C???? Are you on drugs??

C is way complex than Modern C++. C is hard to use than Modern C++.

Modern C++ is like Python.
 
Last edited:
What are that different tools and libraries you have create yourself?

Show me as single library Modern C++ doesn't has but exists in Node/Python.

I'm sure you are using C not Modern C++. The Collages teach poor old C with classes. Yanks!

You can even build your front end with C++,

https://mbasso.github.io/asm-dom/
Vue like framework for C++



What???? C???? Are you on drugs??

C is way complex than Modern C++. C is hard to use than Modern C++.

Modern C++ is like Python.
Modern C++ is definitely better, but it does have a lot of nuances. You have to think about variable typing, memory management (or at least how to use modern C++ tools which are safe about memory management), and concepts like linking / compiling to integrate third-party APIs. Definitely agree it's easier than old C
 
Modern C++ is definitely better, but it does have a lot of nuances. You have to think about variable typing, memory management (or at least how to use modern C++ tools which are safe about memory management), and concepts like linking / compiling to integrate third-party APIs. Definitely agree it's easier than old C

If you are manually managing memory in Modern C++, you're doing it WRONG!

As for linking and compiling, there is CMake which supports vcpkg.


Typing is just like typescript.


int
std::string
std::vector
float

etc
 
i would say go for the language you know, but it's so much easier in php and js, there are libs that read the dom-tree, you can use the css selectors to fetch elements from the page and get the text from them. I imagine c++ is so more low-level
 
i would say go for the language you know, but it's so much easier in php and js, there are libs that read the dom-tree, you can use the css selectors to fetch elements from the page and get the text from them. I imagine c++ is so more low-level
php is ok for small bots, js just maybe to automate one website. however js is not really ment to create bots at all.
if you want something that is fast (multithreaded) and can be scaled without using 100% of the CPU/RAM for small tasks, then C/C++ or C# is the way to go.
 
agreed, depends on the scale of your task, if it's millions page hits then it makes sense
 
i would say go for the language you know, but it's so much easier in php and js, there are libs that read the dom-tree, you can use the css selectors to fetch elements from the page and get the text from them. I imagine c++ is so more low-level
Speaking of bots and DOM: as a member of a team battling these very bots, I'd say the most universal framework for a web bot would be a headless browser such as Puppeteer, Playwright, Selenium, PhantomJS, etc. All of these tools allow for remote browser control and running of custom JS code within page context. And the most natural choice for a language to control them would be Node.js, with all required libraries readily available via NPM. Just a bit of info to consider.
 
On a related note: is it a good idea to learn C++ AFTER I learn Python?
 
With the libraries that phyton has, it makes it much easier for you to create bots, since it brings a lot of written code.
 
Speaking of bots and DOM: as a member of a team battling these very bots, I'd say the most universal framework for a web bot would be a headless browser such as Puppeteer, Playwright, Selenium, PhantomJS, etc. All of these tools allow for remote browser control and running of custom JS code within page context. And the most natural choice for a language to control them would be Node.js, with all required libraries readily available via NPM. Just a bit of info to consider.
yes for the sites that seriously battle the bots it's our best bet :) but when it comes to just scraping some content these tools could be over complicated for initial setup
 
On a related note: is it a good idea to learn C++ AFTER I learn Python?
Sure, why not. But prepare for a very special idea that C++ has about OOP. With an open mind, C++ will be challenging yet very interesting language to learn.

yes for the sites that seriously battle the bots it's our best bet :) but when it comes to just scraping some content these tools could be over complicated for initial setup
Yeah. With PHP, scraping a page can be as simple as a single call to file_get_contents() with subsequent parsing the DOM using PHP's stock DOMDocument extension.
 
BTW, in case anyone wants to code up a bot in C++ here's an advice: consider using POCO C++ libraries for a framework, there's a decent threaded implementation of an HTTP client. We use POCO libraries in our anti-fraud software that is sold to ad & CPA networks, and it is a truly invaluable framework that lets you speed up development dramatically.
 
Back
Top