Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "windows.h"
  3. #include <urlmon.h>
  4. #include <fstream>
  5. #include <iostream>
  6. #include <string>
  7. #include <vector>
  8. #include <experimental/filesystem>
  9. #pragma comment(lib, "urlmon.lib")
  10.  
  11. std::string getPageContent(std::string url);
  12.  
  13. void main()
  14. {
  15. std::ifstream infile(std::experimental::filesystem::current_path().string() + "\\words.txt");
  16. std::ofstream outfile(std::experimental::filesystem::current_path().string() + "\\output.txt");
  17. std::string line;
  18. while (getline(infile, line))
  19. {
  20. if (getPageContent(line).find(":: Error</title>") != std::string::npos)
  21. {
  22. std::cout << "ID: " << line << std::endl;
  23. outfile << "ID: " << line << std::endl;
  24. }
  25. }
  26. outfile.close();
  27. }
  28.  
  29. std::string getPageContent(std::string id)
  30. {
  31. std::wstring url = L"https://steamcommunity.com/id/" + std::wstring(id.begin(), id.end());
  32. std::wstring path = std::experimental::filesystem::current_path().wstring() + L"\\cur.html";
  33. URLDownloadToFile(NULL, url.c_str(), path.c_str(), 0, NULL);
  34. return std::string((std::istreambuf_iterator<char>(std::ifstream(path))), std::istreambuf_iterator<char>());
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement