Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 526e1ce

Browse files
authored
Add files via upload
ShinyScrape scrapes the site... i think Worksheet is where it is put into an excel worksheet google_io is where it sends info to sheets im pretty sure
1 parent bf804de commit 526e1ce

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

ShinyScrape.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from bs4 import BeautifulSoup
2+
import xlwt
3+
import urllib.request
4+
5+
url = "https://www.serebii.net/sunmoon/pokemon.shtml"
6+
7+
thePage = urllib.request.urlopen(url)
8+
soupData = BeautifulSoup(thePage,"html.parser")
9+
10+
11+
def main():
12+
13+
book = xlwt.Workbook()
14+
sheet = book.add_sheet('Test')
15+
book.save('Text.xls')
16+
17+
sheet.write(0, 0, 'test')
18+
19+
book.save('Text.xls')
20+
21+
22+
x = 721
23+
for img in soupData.findAll('img'):
24+
x = x +1
25+
if (x < 810):
26+
temp = img.get('src')
27+
28+
temp = "https://www.serebii.net/Shiny/SM/" + str(x) + ".png"
29+
print(temp)
30+
31+
32+
33+
main()

Worksheet.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from bs4 import BeautifulSoup
2+
import xlwt
3+
import xlrd
4+
import urllib.request
5+
import gspread
6+
import json
7+
from oauth2client.service_account import ServiceAccountCredentials
8+
9+
url = "https://www.serebii.net/sunmoon/pokemon.shtml"
10+
11+
thePage = urllib.request.urlopen(url)
12+
soupData = BeautifulSoup(thePage, "html.parser")
13+
14+
15+
book = xlwt.Workbook()
16+
sheet = book.add_sheet('Alola')
17+
book.save('Shiny Alola.xls')
18+
19+
20+
#sheet.write(0, 0, 'test')
21+
22+
#scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
23+
24+
#credentials = ServiceAccountCredentials.from_json_keyfile_name('creds.json', scope)
25+
26+
#gc = gspread.authorize(credentials)
27+
28+
#wks = gc.open('Shiny').sheet1
29+
y = 0
30+
x = 721
31+
for img in soupData.findAll('img'):
32+
x = x + 1
33+
if (x < 810):
34+
temp = img.get('src')
35+
36+
temp = "https://www.serebii.net/Shiny/SM/" + str(x) + ".png"
37+
print(temp)
38+
#wks.append_row(['=image("' + temp + '",4,200,200)'])
39+
sheet.write(y, 0, '=image("' + temp + '",4,100,100)')
40+
book.save('Shiny Alola.xls')
41+
y = y + 1
42+
43+
44+

google_io.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import gspread
2+
import json
3+
import xlwt
4+
import xlrd
5+
from oauth2client.service_account import ServiceAccountCredentials
6+
7+
book = xlwt.Workbook()
8+
wb2 = xlrd.open_workbook('Shiny Kanto.xls')
9+
10+
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
11+
12+
credentials = ServiceAccountCredentials.from_json_keyfile_name('creds.json', scope)
13+
14+
gc = gspread.authorize(credentials)
15+
16+
wks = gc.open('Shiny').sheet1
17+
18+
x = 13
19+
20+
sheet1 = wb2.sheet_by_name('Kanto')
21+
22+
while x < 164:
23+
curr = sheet1.row_values(x)
24+
print(curr)
25+
wks.append_row([curr])
26+
x = x + 1

0 commit comments

Comments
 (0)