import requests from bs4 import BeautifulSoup def get_page_data ( html ) : soup = BeautifulSoup ( html . text , 'html.parser' ) tables = soup . find_all ( 'table' ) a_tags = tables [ 4 ] . find_all ( 'a' ) sites_list = open ( "bug-bounty-sites.txt" , "w" ) for a in a_tags : sites_list . write ( a . get ( 'href' ) + '\n' ) if __name__ == '__main__' : url = 'https://www.vulnerability-lab.com/list-of-bug-bounty-programs.php' headers = { 'User-Agent' : 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36' } page = requests . get ( url , headers = headers ) get_page_data ( page )