Skip to content

Instantly share code, notes, and snippets.

@aipi
Created November 26, 2017 01:49
Show Gist options
  • Save aipi/307100b135ee0dfd31aeb103ffb8674a to your computer and use it in GitHub Desktop.
Save aipi/307100b135ee0dfd31aeb103ffb8674a to your computer and use it in GitHub Desktop.
example used in PI4
class GetTopSitesListAditionalInformation(LogIntoAlexa):
def __init__(self):
super().__init__()
self.top_list = json.load(open('../data/data.json'))
self.url = 'https://www.alexa.com/siteinfo/'
def get_additional_informations(self):
self.log_into_alexa()
i = 0
for key, value in self.top_list.items():
i += 1
print(i)
url = self.url + key
request = self.session_requests.get(
url, headers=dict(referer=url))
soup = BeautifulSoup(request.text, "html.parser")
self.top_list[key]['audience_geography'] = \
self.__get_audience_geography(soup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment