Translate from Python to C#

  • Thread starter Thread starter HisKingdom
  • Start date Start date
H

HisKingdom

Guest
```
import requests
import htmlement
import json
import sys

z = requests.get("Proxy Checker")
w = htmlement.fromstring(z.text, "div", attrs= {"class" : "block archive full_list"})

urls = []
proxies = []
filename = ""

if len(sys.argv) == 2:
filename = sys.argv[1]
else:
filename = "hpg_result.json"


for e in w.iterfind("./ul/li"):
urls.append(e.find("a").get("href").strip())

#print(urls)


def apiGetTable(archive):
burp0_url = "Proxy Checker" + archive
burp0_cookies = {"__cfduid": "d356dda814ab6298183b5de678aa99de71581089315", "_ga": "GA1.2.1707960377.1581089468", "_gid": "GA1.2.20848077.1581089468"}
burp0_headers = {"User-Agent": "Mozilla/1.0 (Linux; deb64; rv:69.0) Gecko/10100101 Firefox/69.0", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Referer": "Proxy Checker" + archive, "Connection": "close"}
return requests.get(burp0_url, headers=burp0_headers, cookies=burp0_cookies).text

for archive in urls:
print("Adding " + archive + "...", end=' ')
proxy = json.loads(apiGetTable(archive))
proxies.append(proxy)
print("Done")


print("Writing to " + filename + "...", end=' ')

with open(filename, "w") as output_file:
json.dump(proxies, output_file)


print("Done")


I would appreciate it as I am new to working with html.

Thank you for your time.


Continue reading...
 
Back
Top