#!/usr/bin/env python # -*- coding: utf-8 -*- # Script for get data of trafficban.com # List of: [Date] - [Country] - [Ban time]. # Save data to data.html, then u can copy it to excel, or whatever # This script is slowly, because I contact other subweb for get date # U can disable it commenting from * import requests from bs4 import BeautifulSoup import datetime link = "http://trafficban.com" data = requests.get(link) parse_data = BeautifulSoup(data.text) bans = parse_data.findAll('tr', class_='ban_row') html = """
Date | Country | Ban time | """ current = 0 for ban in bans: info_link = ban['data-href'] day = "No available" # * comment from here r_ = requests.get("http://trafficban.com/%s" % info_link) s_ = BeautifulSoup(r_.text) day = s_.find("span", class_="hidden-md hidden-lg text-center") day_number = str(day.h1)[4:str(day.h1).find("
---|---|---|
%s | %s | %s |