Question how to convert?

Status
Not open for further replies.

zattat

New member
Joined
May 6, 2021
Messages
2
Programming Experience
Beginner
how to convert to vb.net?

import threading,time,sys
try:
import requests
except:
print("Please install requests module!")
sys.exit()

path=input("File (example: file.m3u) => ")
out=path+"_out.txt"

try:
with open(path, 'r') as file_in:
lines = file_in.read().splitlines()
except:
print("File error or not found!")

file_out=open(out, "w")
#print(str(lines))

all = len(lines)
print(all)
worked=0
print("Scanning {} lists... Worked will write in {}".format(all,out))
time.sleep(5)
def check(i):
global worked
thisline=str(i)
file_out.write(thisline+"\n")
if thisline.startswith("#") == False:

print("Checking "+thisline+"...")


if "m3u8" not in thisline:
if thisline.endswith("/") == False:
thisline=thisline+".m3u8"
else:
thisline=thisline+"/index.m3u8"


try:
req=str(requests.get(thisline, timeout=(2,5)).status_code)
if req == "200" or (req == "302"):
print("OK. "+thisline)
worked+=1
#write here
file_out.write(thisline+"\n")
except:
print("ERROR. "+thisline)


for i in lines:
threading.Thread(target=check,args=(i,)).start()
 
You're going to have to do much better than that if you'd like strangers to volunteer their time to help you. You haven't even bothered to tell us what language you're converting from and just expected us to work it out. You haven't bothered to format your code either, so it is much harder to read than is necessary.

Regardless, unless the source language is C#, there's never going to be a 1:1 correspondence between the source and the equivalent VB. That means that the way to convert any language to any other language is to understand the functionality being implemented by the original code and then to write the best code you can that implements that same functionality. That's for you to do, not us. If there's something that you don't understand about the original code then you should ask about that on a site dedicated to that language. Once you do understand the functionality, it's for you to start writing VB code to implement it. If you have trouble implementing something specific in VB then that is a question you can ask here. It needs to be specific though. Expecting VB developers to interpret a completely different language for you and then write your VB code for you is not what this site is for.
 

jmcilhinney "Regardless, unless the source language is C#"​

first of all it is not a C# source code
it is python source code
if it was a C# source code it was very easy to convert it to vb.net
with any online converter
but there ain't any python to vb.net converter
so the question for convertion was put here
do you get it?

jmcilhinney if you dont know to convert it​

then kindly don't comment about what you can't and don't know about
there must be other educated developers who can convert it
if possible!

jmcilhinney about , "understand the functionality being implemented by the original code and then to write the best code you can that implements that same functionality. That's for you to do, not us"

if that was to done then why even bother to convert it to vb.net?

jmcilhinney about , " Expecting VB developers to interpret a completely different language for you and then write your VB code for you is not what this site is for."

isn't this question forum site for vb.net?
read the question, "how to convert to vb.net?"
if you cant don't comment about it.
as this site has many unsolved / unanswered question
it will one of those unsolved / unanswered question
it is simple as that.
 
As a moderator, it is my responsibility to inform people if they are using this site inappropriately. You are using this site inappropriately so I informed you. It's not for you to tell us what threads we can and cannot post to.

You asked how to convert the code and I told you: understand what the existing code is doing and write code to do the same thing in VB. Whether it be you who does it or someone else, that's what needs to happen. You may not like that but that doesn't change the facts of the matter. It seems that you simply don't want to have to do that. Unfortunately, there's no other way.

If we were to see you making an effort on your own behalf, you'd likely find more people inclined to help. Just asking others to do your work for you is not asking for help though. Help would imply that you're doing some of the work too. If you just want others to do your work for you, you're unlikely to find too many willing to be taken advantage of.

To be frank, this isn't even a VB.NET question. A VB.NET question would be "I'm trying to implement X functionality in VB and don't know how" but if you don't even know what it is that you're trying to implement then it's not yet a VB issue. If you want help understanding the Python code, that would be a question for a Python forum. I'm closing this thread. You should feel free to return when you have a VB question we can help with.
 
Status
Not open for further replies.
Back
Top