Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from bs4 import BeautifulSoup
- base = 'https://etherscan.io/tokenholdingsHandler.ashx?&a='
- # https://etherscan.io/tokenholdings?a=0x795476Fe57865598a85F28b1E53A430932E66CC1
- tail_menu = {
- 'add1': '0x3214973ADa17253048e14d712142b1dd09C25531&q=&p=1&f=0&h=1&sort=total_price_usd&order=desc&pUsd24hrs=&pBtc24hrs=&pUsd=&fav=',
- }
- def set_urls():
- for x in tail_menu:
- url = base + tail_menu.get(x)
- send_url(url)
- def send_url(x):
- request = requests.get(x)
- response = str(request.content)
- with open('test.html', 'w') as response_html:
- response_html.write(response)
- htmlfile = open('test.html', 'r')
- soup = BeautifulSoup(htmlfile, 'html.parser')
- test = soup.find_all(htmlfile, '"totaleth"')
- for tag in test:
- print(tag.text.strip())
- new_list = []
- for y in test:
- y = str(y)
- y = y.split('>', 1)[-1]
- y = y.split('<', 1)[0]
- y = y.split('\'', 1)[0]
- y = y.replace(u'\xa0', u'')
- new_list.append(y)
- print('{} - {}'.format(x, new_list[2:][:2]))
- with open('finaldata.text', 'a+') as storedata:
- storedata.write('\n{} - {}'.format(x, new_list[2:][:2]))
- set_urls()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement