def mirrors(self): return vgscraper.get_mirror_list()
def mirrors(self): html = """ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>AutoGate | Mirrors</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <style type="text/css"> table { border-collapse: collapse; font-family: "Lucida Grande", sans-serif; width: 100%; font-size: 13px; } table, th, td { border: 2px solid #d3d3d3; } th { color: #fff; background-color: #2c76b5; } tr { text-align: center; height: 60px; } tr:nth-child(odd) { background-color: #ffffff; } tr:nth-child(even) { background-color: #ffffef; } </style> </head> <body> <table> <thead> <tr> <th>Country</th> <th>URL</th> </tr> </thead> <tbody id="table-body"> </tbody> </table> </body> </html> """ bs = bs4.BeautifulSoup(html, "html.parser") table_body = bs.find(id="table-body") mirror_list = vgscraper.get_mirror_list() for mirror_data in mirror_list: table_row = bs.new_tag("tr") # Country country_col = bs.new_tag("td") country_col.string = mirror_data["country"] table_row.append(country_col) # URL url_col = bs.new_tag("td") url_link = bs.new_tag("a", href=mirror_data["url"]) url_link.string = mirror_data["url"] url_col.append(url_link) table_row.append(url_col) table_body.append(table_row) return str(bs)