Created
July 2, 2019 12:48
-
-
Save CavaTrendy/b6eb40f52ddd141f0256f1b680f9a757 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
***** | |
*Author: Giorgio Alessandro Motta | |
* | |
***** | |
import datetime | |
import lxml.html as lh | |
import pandas as pd | |
import requests | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
###### | |
# Selenium getting the link | |
###### | |
chrome_options = Options() | |
chrome_options.add_argument('--headless') | |
driver = webdriver.Chrome(executable_path='C:/Users/gmotta/Documents/Wallet/Bot/chromedriver', options=chrome_options) | |
driver.get('https://ropsten.etherscan.io/token/0x74133d249f2376145067e72ab85d59c8d3811e90') | |
driver.implicitly_wait(5) | |
get_url = driver.find_element_by_id("tokentxnsiframe").get_attribute("src") | |
driver.close() | |
###### | |
# Opening page | |
###### | |
url = get_url | |
page = requests.get(url) | |
doc = lh.fromstring(page.content) | |
tr_elements = doc.xpath('//tr') | |
###### | |
# Write To Panda | |
##### | |
tx = [] | |
age = [] | |
from_ = [] | |
to = [] | |
tokenid = [] | |
for i in tr_elements[1:]: | |
el1 = tx.append(i[0].text_content()) | |
el2 = age.append(i[1].text_content()) | |
el3 = from_.append(i[2].text_content()) | |
el4 = to.append(i[4].text_content()) | |
el5 = tokenid.append(i[5].text_content()) | |
data = pd.DataFrame({'Transaction': tx, 'Age': age, 'From': from_, 'To': to, 'TokenID': tokenid}) | |
##### | |
# Print to CSV | |
#### | |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") | |
export_csv = data.to_csv(r'C:/Users/Name/Documents/Wallet/Bot/TokenTesetNet' + timestamp + '.csv', index=None, | |
header=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
***** | |
*Author: Giorgio Alessandro Motta | |
* | |
***** | |
import csv | |
import datetime | |
import glob | |
import os | |
import lxml.html as lh | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
import requests | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
###### | |
# Selenium getting the link | |
###### | |
chrome_options = Options() | |
chrome_options.add_argument('--headless') | |
driver = webdriver.Chrome(executable_path='C:/Users/gmotta/Documents/Wallet/Bot/chromedriver', options=chrome_options) | |
driver.get('https://etherscan.io/token/0x06012c8cf97bead5deae237070f9587f8e7a266d') | |
driver.implicitly_wait(5) | |
get_url = driver.find_element_by_id("tokentxnsiframe").get_attribute("src") | |
driver.close() | |
###### | |
# Opening page | |
###### | |
url = get_url | |
page = requests.get(url) | |
doc = lh.fromstring(page.content) | |
tr_elements = doc.xpath('//tr') | |
###### | |
# Write To Panda | |
##### | |
tx = [] | |
age = [] | |
from_ = [] | |
to = [] | |
tokenid = [] | |
for i in tr_elements[1:]: | |
el1 = tx.append(i[0].text_content()) | |
el2 = age.append(i[1].text_content()) | |
el3 = from_.append(i[2].text_content()) | |
el4 = to.append(i[4].text_content()) | |
el5 = tokenid.append(i[5].text_content()) | |
data = pd.DataFrame({'Transaction': tx, 'Age': age, 'From': from_, 'To': to, 'TokenID': tokenid}) | |
##### | |
# Print to CSV | |
#### | |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") | |
export_csv = data.to_csv(r'C:/Users/Name/Documents/Wallet/Bot/TokenMainNet' + timestamp + '.csv', index=None, | |
header=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment