NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
import random
import urllib
from threading import Thread

ua = UserAgent() # From here we generate a random user agent
proxies = [] # Will contain proxies [ip, port]
proxy_check_thread_list = list()

def is_bad_proxy(pip):
try:
proxy_handler = urllib.request.ProxyHandler({'https': pip})
opener = urllib.request.build_opener(proxy_handler)
urllib.request.install_opener(opener)
sock=urllib.request.urlopen('https://ipinfo.io/ip') # change the url address here
#sock=urllib.urlopen(req)
except urllib.error.HTTPError as e:
print('Error code: ', e.code)
return 1, e.code
except Exception as detail:
return 1, detail
return 0, sock.read().decode("UTF-8")


# Main function
def proxy_check():
# Retrieve latest proxies
proxies_req = Request('https://www.sslproxies.org/')
proxies_req.add_header('User-Agent', ua.random)
proxies_doc = urlopen(proxies_req).read().decode('utf8')

soup = BeautifulSoup(proxies_doc, 'html.parser')
proxies_table = soup.find(id='proxylisttable')

# Save proxies in the array
for row in proxies_table.tbody.find_all('tr'):
proxies.append({
'ip': row.find_all('td')[0].string,
'port': row.find_all('td')[1].string
})

# Choose a random proxy

for proxy in proxies:
item = proxy['ip'] + ':' + proxy['port']
proxy_status, proxy_ip = is_bad_proxy(item)
if proxy_status:
pass
else:
print(item)
# Retrieve a random index proxy (we need the index to delete it if not working)
def random_proxy():
return random.randint(0, len(proxies) - 1)


def main():
proxies = proxy_check()
pip = random_proxy()

proxy_thread_list = list()
for counter in range(1, 10):
proxy_thread = Thread(target=is_bad_proxy, args=(pip))
proxy_thread.start()
pip = random_proxy()
proxy_thread_list.append(proxy_thread)

main()
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.