Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket, re as regex, requests as Requests
- def bing(site):
- url = 'https://bing.com/search/'
- ip = socket.gethostbyname(site)
- agent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0'
- timeout = 10
- pattern = regex.compile(r'\<h2\>\<a href="(.*?)" h=".*?"\>')
- requests = Requests.session()
- first = 1
- header = {'User-Agent' : agent}
- results = []
- while(first <= 20 + 1):
- param = {
- 'first' : first,
- 'form' : 'PERE',
- 'q' : 'ip:' + ip
- }
- request = requests.get(url = url, params = param, headers = header, timeout = timeout)
- if request.status_code != 200:
- return {'status' : 'Fail', 'message' : 'There\'s something happen with the site.'}
- print(request.url)
- first += 10
- bing('mmk.id')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement